![]() 'hello world hello'.indexOf('world', 12) returns -1 - because, while it's true the substring world occurs at index 6, that position is not greater than or equal to 12. ![]() 'hello world hello'.indexOf('o', -5) returns 4 - because it causes the method to behave as if the second argument were 0, and the first occurrence of o at a position greater or equal to 0 is at position 4.If position is less than zero, the method behaves as it would if position were 0. If position is greater than the length of the calling string, the method doesn't search the calling string at all. The method returns the index of the first occurrence of the specified substring at a position greater than or equal to position, which defaults to 0. All values are coerced to strings, so omitting it or passing undefined causes indexOf() to search for the string "undefined", which is rarely what you want. Object.prototype._lookupSetter_() Deprecated.Object.prototype._lookupGetter_() Deprecated.Object.prototype._defineSetter_() Deprecated.Object.prototype._defineGetter_() Deprecated.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |