Here it is:
var obj = {
'city': 'ny',
}
I write a comma in the end after ny
but this could run in Chrome and Firefox, but not in IE6/7
So does this kind of syntax is right or wrong or recommended?
Here it is:
var obj = {
'city': 'ny',
}
I write a comma in the end after ny
but this could run in Chrome and Firefox, but not in IE6/7
So does this kind of syntax is right or wrong or recommended?
there should be not comma,if you have only one key and value.
If you are separating the Key & Value Pairs with comma then it is called as Object Literals.
var obj = {
'city': 'ny'
}