I have a javascript object which I use as type of map with key value pairs.
Population of this map occurs when value is injected to it from controller :
var people = {"2":"Brad","3":"Antonio","5":"Stacy","6":"Marry","1":"Jim"}
I want to create a new object but with one more entry i.e in pseudo code
var new_people = people + {11: "John"}
I tried to copy people to new people first and then :
new_people.\"11\" = "John"
and
new_people."11" = "John"
Both produce failure. While any string instead of number works i.e
new_people.anystring = "John"
var new_people = {"2":"Brad","3":"Antonio","5":"Stacy","6":"Marry","1":"Jim", "anystring":"John"}
1stringis a string, butnew_people.1stringwon't work.new_people.anystring = "John",anystringis a sequence of characters, but it is not a string in the sense of a JavaScript data type. It is an identifier name.