title: What are the valid characters/values allowed as "keys" in javascript object?
body: <p>I tried a few of them,</p>
  <pre><code>const obj = {
      '`' : 1,
      '@' : 2,
      '^' : 3,
      '-' : 4,
      '?' : 5,
      ']' : 6,
      '*' : 8,
      ')' : 9,
      '/' : 10,
      '&gt;' : 11,
      'ル': 12
  }
  
  console.log(obj); //{ '`': 1, '@': 2, '^': 3,'-': 4, '?': 5, ']': 6, '*': 8, ')': 9, '/': 10, '&gt;': 11, 'ル': 12}
  </code></pre>
  <p>So my question is, what is that superset of characters(individually not a combination of them, which obviously, would be silly to ask) which can qualify as a key in an JavaScript object?</p>
  <p><strong>EDITED ----</strong>
  Definitely not a duplicate! Not sure why is it still marked so!
  I've had people comparing JSON with JavaScript objects and deriving answers from them.
  I do understand <a href="https://stackoverflow.com/questions/8676011/which-characters-are-valid-invalid-in-a-json-key-name">Which characters are valid/invalid in a JSON key name?</a> has some good insights.</p>
  <p>But to touch upon whether a few things are allowed or disallowed wrt comparison between JSON and JavaScript &quot;keys&quot; <strong>purely keeping in mind whether those keys are allowed to be typed in or not</strong>, how about <strong>null</strong>, <strong>undefined</strong>?</p>
  <p>I'm not getting into how they are internally coerced and inserted as keys or what coercion takes place while retrieving the value using the brackets <strong>[ ]</strong> notation. Purely based on whether you are allowed to type in that value or not, <strong>yes there is a difference between which keys are allowed in JSON vs what is allowed in JavaScript object</strong>.</p>
  <p><em>null as key in JavaScript object</em></p>
  <pre><code>let x = {null: 10};
  for(let key in x){
      console.log(key); //null
      console.log(typeof key); //string
  }
  </code></pre>
  <p><strong>Works</strong></p>
  <p><em>null as key in JSON</em></p>
  <pre><code>{
      null: 10
  }
  </code></pre>
  <p><strong>Doesn't work</strong></p>