title: Why does JavaScript use Symbols instead of just strings?
body: <p>"Iterables" in JavaScript are objects with a <code>Symbol.iterator</code> property. For example: </p>
  
  <pre><code>let x = { 
    [Symbol.iterator]: function * () { 
      yield * [ 1, 2, 3]; 
    } 
  };
  
  [ ...x ] // Array [ 1, 2, 3 ]
  </code></pre>
  
  <p>So <code>Symbol.iterator</code> is just a convention. </p>
  
  <p>But why was this concept, <code>Symbol</code>, invented when a <code>string</code> could have done a similar job?</p>
  
  <pre><code>let x = { 
    iterator: function * () { 
      yield * [ 1, 2, 3 ]; 
    } 
  };
  
  // Invalid, but would be equivalent to [ ...x['iterator']() ]
  [ ...x ] 
  </code></pre>