I have to create array in which key (Index) will be strId (typeof strId is "string") when I am doing so I am getting undefined value in list Below is code.
var myRoomIdList = [];
var strId = "43457";
myRoomIdList[strId] = strId;
console.log(myRoomIdList);
console.log(myRoomIdList.length);
console.log(myRoomIdList);
Output: Undefined, undefiend, ......43457 times
console.log(myRoomIdList.length);
Output: 43457
Please can anyone figure out why It's behaving in this manner. Any help will be appreciated.
var myRoomIdList = {};