Can i use
myWidget.errorLableMap.key ="errormsg";
insted of following to set property of a js object/map.
myWidget.errorLableMap["key"] ="errormsg";
开发者_StackOverflow社区
You can do both - they are equal ways of assigning a property value. The difference is - using [] you can work with properties that are not valid variable names in javascript, e.g. you can do:
myWidget.errorLableMap["key 1"] = "something"
but obviously following will not work:
myWidget.errorLableMap.key 1 = "something"
精彩评论