| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Missing_bracket_after_list | [Back] [Original] |
Get to know MDN better
The JavaScript exception "missing ] after element list" occurs when there is an error
with the array initializer syntax somewhere. Likely there is a closing square bracket
(]) or a comma (,) missing.
SyntaxError: missing ] after element list (Firefox) SyntaxError: Unexpected token ';'. Expected either a closing ']' or a ',' following an array element. (Safari)
There is an error with the array initializer syntax somewhere. Likely there is a
closing square bracket (]) or a comma (,) missing.
const list = [1, 2,
const instruments = [
"Ukulele",
"Guitar",
"Piano",
};
const data = [{ foo: "bar" } { bar: "foo" }];
Correct would be:
const list = [1, 2];
const instruments = ["Ukulele", "Guitar", "Piano"];
const data = [{ foo: "bar" }, { bar: "foo" }];
This page was last modified on Jul 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |