[Solved] “Uncaught SyntaxError: Unexpected token , ” when create my object javascript


All objects must have keys. You define an object using curly bracers {}.

Basically what you are saying is, add an array with one object that has no keys defined.

If you want an array with the values a,b,c,d you can remove the bracers:

myObjectList[0] = ["a", "b", "c", "d"];

You always define objects with keys:

var myObject = {
    "a" : "A",
    "b" : "B",
    "c" : "C",
    "d" : "D",
}

1

solved “Uncaught SyntaxError: Unexpected token , ” when create my object javascript