$(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?

Recommended Answers

All 4 Replies

Missing colon after c I guess.

Member Avatar

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

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" }

Member Avatar

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.