title: Highlight current page in menu using javascript
body: <p>This following code worked fine. But the teacher asked me to explain "if(menu!==null)" and I couldn't explain it. He said it was mandatory, but I deleted it and it still worked. This is an example of Home page.</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>function setBold() {
    var menu = document.getElementById('page').getAttribute("data-page");
    if (menu !== null) {
      document.getElementById(menu).className = "active";
    }
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.active {
    font-weight: bold;
    font-size: 18px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body onload="setBold()" id="page" data-page="Home"&gt;
    &lt;div class="menu"&gt;
      &lt;a id="Home" href=""&gt;Home&lt;/a&gt;
      &lt;a id="About" href=""&gt;About My Cakes&lt;/a&gt;
      &lt;a id="Find" href=""&gt;Find Maria's Coffe&lt;/a&gt;
    &lt;/div&gt;
  
    &lt;body&gt;</code></pre>
  </div>
  </div>
  </p>