141
rated 0 times
[
146]
[
5]
/ answers: 1 / hits: 56219
/ 12 Years ago, thu, november 22, 2012, 12:00:00
I have a variable:
var code = de;
And I have an array:
var countryList = [de,fr,it,es];
Could someone help me as I need to check to see if the variable is inside the countryList array - my attempt is here:
if (code instanceof countryList) {
alert('value is Array!');
}
else {
alert('Not an array');
}
but I get the following error in console.log when it's run:
TypeError: invalid 'instanceof' operand countryList
More From » arrays