December 2013
Intermediate to advanced
384 pages
9h 54m
English
var s1 = "I think therefore I am"; var a = s1.indexOf("think"); // a = 2 var b = s1.indexOf("thought"); // b = -1
The simplest way to check to see if one string is a substring of another is to use .indexOf(substring) on the main string. This function returns an index of the location of the first occurrence, or –1 if the substring is not found.
Read now
Unlock full access