- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › syntax error
var match = [“¶meterId=documentation”, “documentation”];
($.inArray(‘documentation’,match) returning 1.
if($.inArray(‘documentation’,match)) giving syntax error
Also
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.