jsオブジェクト属性名の書き方
10535 ワード
Notation of Keys
This error arrises from the fact that
var test = { 'case': 'I am a keyword so I must be notated as a string', delete: 'I am a keyword too so me' // raises SyntaxError };
Object properties can be both notated a s plane characters and as strigs.Due to another mis-design JavaScript's parser,the above will throw a SyntaxError
pror to ECMAScript 5.This error arrises from the fact that
delete
is a keyword;therefore,it must be notated as a string lieral to ensure that it will be corectly interpreted by older JavaScript engies.