The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript syntax error

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #152474

    var match = [“&parameterId=documentation”, “documentation”];

    ($.inArray(‘documentation’,match) returning 1.

    if($.inArray(‘documentation’,match)) giving syntax error


    var match =” &parameterId=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.


    whup, you’re right.

    @gowda24, as @TheDoc mentioned, it would be much easier to help with a live example (on codepen or jsfiddle). Or at least formatting your code and separating it from your comments – it’s difficult to read when it’s all mixed together.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.