A quick beginner asks.
Suppose I have a javsacript object:
var meh=[["cars",27], ["bikes",85], ["skates",4]];
To go through each data object here, I can do this:
$.each(meh, function(index,value){
console.log(value)
});
And given that I know the place of, say, cars, I can do this to get access to it:
console.log(meh[0][0]) //shows "Cars"
and of course, if I need the cost of cars, I need to do this:
console.log(meh[0][1]) //Shows 27
Now I have a line - Keys such as cars, bikesorskates
But I can't figure it out: how do I access their respective values?
meh["cars"] returns undefined, because, as I understand it, it cannot find a description outside each object.
I can do meh[0]["cars"], but he defeats the point, as the position of cars can change.
How do I access the value of something with their key?
thank.