title: Code not running in IE 11, works fine in Chrome
body: <p>The following code can be run without a problem in Chrome, but throws the following error in Internet Explorer 11.</p>
  
  <blockquote>
    <p>Object doesn't support property or method 'startsWith'</p>
  </blockquote>
  
  <p>I am storing the element's ID in a variable. What is the issue?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function changeClass(elId) {
    var array = document.getElementsByTagName('td');
    
    for (var a = 0; a &lt; array.length; a++) {
      var str = array[a].id;
      
      if (str.startsWith('REP')) {
        if (str == elId) {
          array[a].style.backgroundColor = "Blue";
          array[a].style.color = "white";
        } else {
          array[a].style.backgroundColor = "";
          array[a].style.color = "";
        }
      } else if (str.startsWith('D')) {
        if (str == elId) {
          array[a].style.backgroundColor = "Blue";
          array[a].style.color = "white";
        } else {
          array[a].style.backgroundColor = "";
          array[a].style.color = "";
        }
      }
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table&gt;
    &lt;tr&gt;
      &lt;td id="REP1" onclick="changeClass('REP1');"&gt;REPS&lt;/td&gt;
      &lt;td id="td1"&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td id="td1"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td id="D1" onclick="changeClass('D1');"&gt;Doors&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td id="td1"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td id="D12" onclick="changeClass('D12');"&gt;Doors&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>