What is mean string contains the characters?

w3schools definition of includes() :-

The includes() method determines whether a "string contains the characters of a specified string".

This method returns true

if the string contains the characters, and false

if not.

Note: The includes() method is case sensitive.

In "string contains the characters of a specified string", I don't understand this sentence, what is mean?


zakariamouhid أضف ردا

أعتقد أن ذلك التعريف فيه سوء فهم لأنه لم يحدد أن المحارف يجب أن تكون بنفس الترتيب

حسب ذلك التعريف فإن هذا السطر سيعيد true وهذا ليس صحيحا

"Hello World".includes("Wd")

الصحيح هو أن includes تحدد إن كان النص المدخل موجود داخل النص المختبر بنفس المحارف ونفس الترتيب

التعريف من MDN يقول:

The includes() method determines whether one string may be found within another string, returning true or false as appropriate.

ببساطة includes تخبرك إن كان النص المدخل موجود داخل النص المختبر