Anonymous JavaScript Objects
Generating JavaScript “object literals”—what Microsoft people might call anonymous objects is the new, sexy way to avoid the new
keyword. This is incorrect syntax: return
{
x:800,
y:600
}This is the correct syntax: return {
x:800,
y:600
}The incorrect syntax can cause an “invalid label” error and the function``()
containing the return statement will have no properties. Note the lack of semicolons. This is not recommended by Mr. Crockford.