I am trying to do the followings:
var Colors = {
'BLUE ': 1,
'RED' : 2,
'YELLOW' : 3
};
var Boxes = {
Colors.BLUE : 5,
Colors.RED : 1,
Colors.YELLOW : 0
};
console.log(Boxes);
However, I get the following error:
Uncaught SyntaxError: Unexpected token .
How do I go about referencing the Colors
object while defining Boxes
?
I would like to do this using only the object literal syntax. Thanks.