I can do:
{test : 10}
But how is this valid JS and why do I get 7 when I add this to the chrome js console?
{test: 10, 7}
How is this trailing 7 valid if it doesn't have a key?
Is this a special JS object literal syntax? Where can I read more about it and why it evaluated to 7?
When I do:
const test = {test: 10, 7}; // VM140:1 Uncaught SyntaxError: Unexpected token '}'
That gives me a expected error so how come without assigning it to a variable it is valid JS and the console returns to me the value 7?
When I do:
{test: 10, 7, 8}
I then get 8
I also get an error if I try JSON notation:
{'test': 10, 7}
Whats going on here?