title: JS document.getElementById() with Int
body: <p>I am getting some <code>DOM elements</code> by <code>document.getElementById({{templete_var}})</code>  the <code>{{templete_var}}</code> can be an <code>Int</code>. I would like to know if this can cause any errors across different browsers/devices. It works fine on Firefox (ubuntu) and Safari (Mac) but are there maybe mobile browsers where this could cause an error? </p>
  
  <p>Here a little code snippet to make it clear what I mean.
  In the code snippet both methods work.</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>// 1 and 2 would be template variables here so I can't "hardcode" them
  document.getElementById(1).style.color = "blue"
  document.getElementById("2").style.color = "red"</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;span id="1"&gt;first text&lt;/span&gt;&lt;br&gt;
  &lt;span id="2"&gt;other text&lt;/span&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Surprisingly I could not find anything on this topic, if this is a duplicate please link the original. </p>