title: Do reserved words need to be quoted when set as property names of JavaScript objects?
body: <p>Given an object literal, or <a href="http://api.jquery.com/jquery/#jQuery-html-attributes" rel="noreferrer"><code>jQuery(html, attributes)</code></a> object, does any specification state that reserved words, or future reserved words MUST be quoted? </p>
  
  <p>Or, can, for example, <code>class</code> be set as a property name of an object without using quotes to surround the property name, without the practice being contrary to a specification concerning identifiers, property names, or use of reserved words?</p>
  
  <p>Seeking a conclusive answer as to this question to avoid confusion.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let objLit = {
    class: 123,
    var: "abc",
    let: 456,
    const: "def",
    import: 789
  }
  
  console.dir(objLit);
  
  jQuery("&lt;div&gt;012&lt;/div&gt;", {
    class: "ghi"
  })
  .appendTo("body");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Related:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/4348478/what-is-the-difference-between-object-keys-with-quotes-and-without-quotes">What is the difference between object keys with quotes and without quotes?</a></p></li>
  <li><p>Comments on this <a href="https://stackoverflow.com/a/36638058/">answer</a></p></li>
  </ul>
  
  <p>Specification</p>
  
  <ul>
  <li><a href="http://www.ecma-international.org/ecma-262/5.1/#sec-7.6" rel="noreferrer">7.6 Identifier Names and Identifiers</a>:</li>
  </ul>
  
  <blockquote>
    <p>Identifier Names are tokens that are interpreted according to the
    grammar given in the <a href="http://unicode.org/versions/Unicode4.0.0/ch05.pdf" rel="noreferrer">“Identifiers” section of chapter 5 of the Unicode
    standard</a>, <em>with some small modifications</em>.<br>
    An Identifier is an IdentifierName that is <em>not a ReservedWord</em></p>
  </blockquote>