S
steven.harms
Hi,
I. Multiple layers of dereferencing:
I took this example from Amy Hoy's javascript tutorial:
var foo = {
bar:"baz",
zort:"narf",
aNumber:5,
anArray:['banana','plaintain','ugli fruit'],
anotherObject: {
king: "hobo"
},
anotherObject2: {
king: "hobo2"
},
doStuff:function() {
alert("I'm doing stuff!")
}
}
When I do
alert(foo.bar) --> "baz" comes up. Great!
Now this works....
// This works
alert(foo.anotherObject.king)
But say i wanted to, based on input, return out of anotherObject or
anotherObject2.
var x="anotherObject"
alert(foo.x.king)
does not work.
Hrm. Is this multiple layer of dereferencing possible?
II. Is there a tutorial for 'intermediate' javascripters?
I. Multiple layers of dereferencing:
I took this example from Amy Hoy's javascript tutorial:
var foo = {
bar:"baz",
zort:"narf",
aNumber:5,
anArray:['banana','plaintain','ugli fruit'],
anotherObject: {
king: "hobo"
},
anotherObject2: {
king: "hobo2"
},
doStuff:function() {
alert("I'm doing stuff!")
}
}
When I do
alert(foo.bar) --> "baz" comes up. Great!
Now this works....
// This works
alert(foo.anotherObject.king)
But say i wanted to, based on input, return out of anotherObject or
anotherObject2.
var x="anotherObject"
alert(foo.x.king)
does not work.
Hrm. Is this multiple layer of dereferencing possible?
II. Is there a tutorial for 'intermediate' javascripters?