After hunting a bit in the official standard for ecmascript ( javascript ), I found where it defines the behavior darren found, and that I really liked.
It is listed in section 11.1.5 as “Object Initialiser”.
An object initialiser is an expression describing the initialisation of an Object, written in a form resembling a literal. It is a list of zero or more pairs of property names and associated values, enclosed in curly braces. The values need not be literals; they are evaluated each time the object initialiser is evaluated.
Being able to
define, instantiate, and initialize an object, declaratively, in one statement-section of code... it's amazingly useful.
I just don't get how... after my YEARS of using javascript... that I've never come across this syntax.