A JavaScript object literal is a comma-separated list of name-value pairs wrapped in curly braces. Object literals encapsulate data, enclosing it in a tidy package. comma , is needed at the end of property declaration. A trailing comma is a comma for your last property. There is no error generated for not putting a comma for…
Posts Tagged
semicolon
Semicolons in Javascript – Where and when?
Semicolon ; is placed at the end of an object declaration, assignment and a return statement. Without a semicolon, the code will be considered “undone”. So a statement will not be a statement, an assignment will not assign anything, a declaration will not declare anything. but wait, read this and this too. What? You are still gonna…