I've got an issue with my code apparently..
function match2(string,pattern){
var patternUpper = pattern.toUpperCase(); // Change pattern to uppercase
var stringUpper = string.toUpperCase(); // Change string to uppercase
for(var i=0;i<stringUpper.length-1;i++){
if(stringUpper.indexOf(patternUpper.charAt(i))<0)
return false;
}
return true;
}
Not sure why Firefox debugger is saying "pattern is undefined", seeing as it was defined in the function, right?
Any help is much appreciated.
Liam
EDIT: It is also doing this for string. Saying "string is undefined" if I comment out the second line of that snippet.
match2 is being called here:
alert(match2("thisisatest","ahtsit"));
The result works as expected, but the issue is causing errors further down in my program I think.
match2, hencepattern.toUpperCase()will throw an error. The symbolpatternwill exist, but if you don't pass an argument, it will have the valueundefined.