[JavaScript] In object literals, only quote properties that are invalid identifiers


#1

When creating an object literal, only quote those properties that are invalid identifiers:

// good
var person = { givenName: "Alex" };
var person = { "given-name": "Alex" };
  
// Bad
var person = { "givenName": "Alex" };

Reasoning: improves readability, especially when using a text editor with syntax highlighting; possible performance optimization depending on the runtime

Reference: Airbnb JavaScript Style Guide, ESLint config quote-props