otnj2ee
10-06-2008, 11:59 PM
Usually, to create an array:
var testAry = new Array();
testAry[0] ="abc";
testAry[1] ="abc1";
testAry[2] ="abc2";
But I also see:
var testAry = new Array();
testAry["abc"] ="abc";
testAry["abc1"] ="abc1";
testAry["abc2"] ="abc2";
Why is a string allowed as an index? I believe the number should only be allowed.
Thanks
Scott
var testAry = new Array();
testAry[0] ="abc";
testAry[1] ="abc1";
testAry[2] ="abc2";
But I also see:
var testAry = new Array();
testAry["abc"] ="abc";
testAry["abc1"] ="abc1";
testAry["abc2"] ="abc2";
Why is a string allowed as an index? I believe the number should only be allowed.
Thanks
Scott