I have read and read and just am not getting it. What exactly is -1 telling me?
Example 1:
if(navInfo.indexOf("Win98" != -1))
{
//do something
}
Example 2:
var myString = "something old, something new, you know the rest"
var foundAtPosition = 0;
var myCount = 0;
while(foundAtPosition != -1)
{
foundAtPosition = myString.indexOf("something", foundAtPostion);
if(foundAtPosition != -1)
{
myCount++;
foundAtPosition++;
}
}
document.write("There are " + myCount + " occurances of something"
;
}
Thank you in advance,
Brian
Example 1:
if(navInfo.indexOf("Win98" != -1))
{
//do something
}
Example 2:
var myString = "something old, something new, you know the rest"
var foundAtPosition = 0;
var myCount = 0;
while(foundAtPosition != -1)
{
foundAtPosition = myString.indexOf("something", foundAtPostion);
if(foundAtPosition != -1)
{
myCount++;
foundAtPosition++;
}
}
document.write("There are " + myCount + " occurances of something"
}
Thank you in advance,
Brian