Lets say we have:
0
:"APPLE"
1
:"ORANGE"
2
:"GRAPES"
- ...
Is there a structure in JavaScript that allows me to get "ORANGE"
from 1
and 1
from "ORANGE"
? I remembered there was such a thing (not Object
or Array
) but can't remember its name, and I couldn't figure out a way to Google it without already knowing what it's called :(
Unless what I'm remembering is from ruby, not JS? In which case what do you call this?
EDIT
I am aware that Object
and Array
can achieve the same result. At this point I just really want to know if there's a specific structure for it, and what its name is, because I thought I remembered seeing it somewhere, either in JS or ruby. Please tell me what it's called, or tell me it doesn't exist, so I can have an ease of mind again..
For JS, I don't think it is Map
either, because the value -> key direction still needed a bit of work.