title: How to compare what the person type? If char equal char do that
body: <p>Im trying to do a comparison with what the user type (his name - char) with the variable name (char). But idk how can i do that.</p>
  
  <pre><code>var nome=document.getElementById("nome").value;
  var mat=document.getElementById("mat").value; //Disciplina
  
  if (nome===name){
      alert("Sua média é: "+ resultado);  
  } else {
      alert("Error.");
      return;
  }
  </code></pre>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;p class="p"&gt;Nome do aluno: &lt;input class ="form-control" id="nome" type="text" name="name" placeholder="Preencha seu nome"/&gt;&lt;/p&gt;
  &lt;button type="button" class="" onclick="media()"&gt;Calcular&lt;/button&gt;
  </code></pre>
  
  <p>Javascript code:</p>
  
  <pre><code>function media() {
      var nome=document.getElementById("nome").value;
      var mat=document.getElementById("mat").value; //Disciplina
  
      if (nome===name){
          alert("Sua média é: "+ resultado);
      } else {
          alert("Error.");
          return;
      }
  }
  </code></pre>