信息
SyntaxError: missing ] after element list
错误类型
哪里出错了?
数组初始化在某处出现了语法错误。比如缺少了右中括号("]
") 或一个逗号 (",
")。
示例
不正确的数组初始化
var list = [1, 2, var instruments = [ "Ukulele", "Guitar", "Piano" }; var data = [{foo: "bar"} {bar: "foo"}];
正确的是:
var list = [1, 2]; var instruments = [ "Ukulele", "Guitar", "Piano" ]; var data = [{foo: "bar"}, {bar: "foo"}];