Browser support for using a reserved word as a property name in JavaScript

后端 未结 4 1054
一个人的身影
一个人的身影 2020-11-30 09:06

I\'m trying to use \"for\" as an object property name. It seems to work fine in IE7, IE8, Firefox, Chrome and Opera, but apparently not in Safari.

My understanding

4条回答
  •  误落风尘
    2020-11-30 09:27

    after study, I think I can prove that using reserved words as property names (if done with a little common sense) is harmless, whether in the obj['name'] or obj.name syntax.

    see this stackoverflow question

提交回复
热议问题