44
rated 0 times
[
45]
[
1]
/ answers: 1 / hits: 141242
/ 13 Years ago, tue, november 29, 2011, 12:00:00
I have a JavaScript object that looks something like this:
var myTextOptions = {
'cartoon': {
comic: 'Calvin & Hobbes',
published: '1993'
},
'character names': {
kid: 'Calvin',
tiger: 'Hobbes'
}
}
I can access the properties of cartoon
easily using myTextOptions.cartoon.comic
or whatever. However, I haven't been able to get the syntax right for accessing kid
. I've tried the following with no luck:
myTextOptions.character names.kid
myTextOptions.character names.kid
myTextOptions.character names.kid
myTextOptions.'character names'.kid
myTextOptions.[character names].kid
myTextOptions.character%20names.kid
More From » object