Created
January 6, 2014 13:23
-
-
Save unknownuser88/8282832 to your computer and use it in GitHub Desktop.
indexOf(substr, [start]) Searches and (if found) returns the index number of the searched character or substring within the string. If not found, -1 is returned. “Start” is an optional argument specifying the position within string to begin the search. Default is 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//indexOf(char/substring) | |
var sentence="Hi, my name is Sam!" | |
if (sentence.indexOf("Sam")!=-1) | |
alert("Sam is in there!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment