Wednesday, October 2, 2013

Why can't I find a slash in indexOf with JavaScript?

Why can't I find a slash in indexOf with JavaScript?

mystring = "playlist/323";
if(mystring.indexOf('playlist/') == 1) {
alert("We got it");
} else {
alert("We don't");
}
I expect it to be show "we got it", but it doesn't.
See my fiddle http://jsfiddle.net/P2TcW/

No comments:

Post a Comment