Im trying to access a property of an object using using a variable which could change
var i = '16';
var object = {
"15" : [ 3, 4, 5, 6 ],
"16" : [ 1, 3 ],
"17" : [ 1, 3, 4, 5, 6 ],
"18" : [ 1, 3, 4 ]
}
console.log( object['i'] )
using the variable gives undefined however using
console.log( object['16'] )
gives you the array of that propery.
Does anyone know how i could work around this