- This topic is empty.
var match = [“¶meterId=documentation”, “documentation”];
($.inArray(‘documentation’,match) returning 1.
if($.inArray(‘documentation’,match)) giving syntax error
var match =” ¶meterId=documentation, documentation”;
match.contains(‘documentation’) returning true
But if(match.contains(‘documentation’)) giving syntax error
Do you have a link to a Codepen or JSfiddle?
The only syntax error I get is because your code uses “smart quotes” instead of normal, straight quotes. But since you say your other statements work as expected, I’ll assume that that’s just the forum trying to make things pretty.
Fixing that, I get:
Uncaught TypeError: Object [object Array] has no method 'contains'
contains is a string method. You can’t use it on an array.