0
$(document).ready(function () {
    var a, b, c
        d = new RegExp("/^[a-z0-9]*$/"),
        e = true,

        f = [
            "g": false,
            "h": false,
            "i": false,
            "j": false,
            "k": false
        ],

I changed names of variables for reasons.

Uncaught SyntaxError: Unexpected token :
Line 7. Which is "g": false,. Am I missing something?

3
Contributors
4
Replies
24
Views
1 Year
Discussion Span
Last Post by diafol
0

If think pritaeas has your issue. However, should it be a semi-colon or comma instead of a colon?

0

Missing colon after c I guess.

While replacing names of variables. I accidentally deleted the comma after c. But in the real script with real names, it is there.

However, should it be a semi-colon or comma instead of a colon?

I don't get it. If you're asking about error, I'm 100% certain it says this (copy-paste):
index.js:7 Uncaught SyntaxError: Unexpected token :.
If you're talking about array, so far Googlable elements told me that JavaScript elements and variables are seperated by , ..

Now that you mentioned, it turns out I got wrong tutorial from the internet. The array should be

array = { elementWithoutQuotes: true, secondElement: "secondvalue" }

0

Vars can be separated by commas. The array you mention in the real script is not really an array but an object. Js doesn.t have associated arrays. When commas etc are left out of var lists, the error can often appear downstream as that.s the first "illegal token" that is encountered.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.