title: Javascript arithmetic operations with switch case
body: <p>I have two input for number1 and number2 with four buttons("+", "-", "*", "/")
  <br><br>
  I want to get operation value from button and pass it to switch case.
  <br><br>
  How do I do that?</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 calculate() {
    var num1 = document.getElementById("num1").value;
    var num2 = document.getElementById("num2").value;
    var islem = document.getElementsByTagName("button").value;
    console.log(num1);
    console.log(num2);
    console.log(islem);
    switch (islem) {
      case "+":
        document.getElementById("sonuc").innerHTML = num1 + num2;
        break;
      case "-":
        document.getElementById("sonuc").innerHTML = num1 - num2;
        break;
      case "*":
        document.getElementById("sonuc").innerHTML = num1 * num2;
        break;
      case "/":
        document.getElementById("sonuc").innerHTML = num1 / num2;
        break;
    }
  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="number" id="num1" placeholder="1. sayı"&gt;
  &lt;input type="number" id="num2" placeholder="2. sayı"&gt;
  &lt;div&gt;
    &lt;ol&gt;
      &lt;button onclick="calculate()" value="+"&gt;[ + ] Topla&lt;/button&gt;
      &lt;button onclick="calculate()" value="-"&gt;[ - ] Çıkar&lt;/button&gt;
      &lt;button onclick="calculate()" value="*"&gt;[ * ] Çarp&lt;/button&gt;
      &lt;button onclick="calculate()" value="/"&gt;[ / ] Böl&lt;/button&gt;
    &lt;/ol&gt;
  &lt;/div&gt;
  
  &lt;input type="number" id="sonuc" placeholder="Sonuç"&gt;</code></pre>
  </div>
  </div>
  </p>