I am trying to check if user code exist in array. But the jQuery code is returning false even when the code exist in array.
function isValidCode(code){
var arr = [1, 2, 3];
//return ($.inArray(code, arr) > -1);
return ($.inArray(code, arr) !== -1);
}
function LuckWinner(key){
if(isValidCode(key)){
console.log(key+ ": is in array");
} else {
console.log(key+" is NOT in array");
}
}