I have this object:
var State = {
WAITING: 1,
READY: 2
}
and this object for getting texts for the state:
var Language = {
States: {
WAITING: "Waiting..",
READY: "Ready!"
}
}
I want to get the text directly from state like this:
var state = State.READY;
var statusText = Language.States[state];
for this to work I need, something like, this illegal syntax:
var Language = {
States: {
State.WAITING: "Waiting..",
State.READY: "Ready!"
}
}
but this doesn't work, what can I use to simply get the text from state variable?