SyntaxError: missing ] after element list
Message
JavaScript
Copy Code
SyntaxError: missing ] after element list
Error type
What went wrong?
There is an error with the array initializer syntax somewhere. Likely there is a closing bracket ("]
") or a comma (",
") missing.
Examples
Incomplete array initializer
JavaScript
Copy Code
var list = [1, 2, var instruments = [ "Ukulele", "Guitar", "Piano" }; var data = [{foo: "bar"} {bar: "foo"}];
Correct would be:
JavaScript
Copy Code
var list = [1, 2]; var instruments = [ "Ukulele", "Guitar", "Piano" ]; var data = [{foo: "bar"}, {bar: "foo"}];
See also
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/javascript/reference/errors/missing_bracket_after_list