associative array: define the undefined?
I just tried the following code (in javascript) which should return 'This
is totally undefined' which did not work:
var foo = {'foo' : 'bar', undefined : 'This is totally undefined!'};
alert( foo['toomany foobars'.match(/asdf/)] );
yet this works perfectly:
var foo = {'foo' : 'bar', undefined : 'This is totally undefined!'};
alert(foo[undefined]);
I don't understand, is there someone who can explain?
Thanks a lot in advance
No comments:
Post a Comment