I have a Javascript snippet like this:
var a = {ac: 10, function(){console.log("hi")}}
The browser is not throwing an error for this. So it may be valid.
But when I use
var a = {ac: 10, function hi(){console.log("hi")}}
The browser throws error:
Uncaught SyntaxError: Unexpected identifier
Can anybody tell me how can I make use of the first code in any scenario in Javascript
Thanks in Advance