title: put in multiply or divide in input field to perform either multiply or divide on the other 2 input fields
body: <p>Hey guys im trying to create a function that takes 3 arguments. The first argument is supposed to be "MULTIPLY" or "DIVIDE" in an input field, then followed by two numbers which are also in separate input fields, that should be either multipled or divided according based on the first argument. I cant figure out exactly how i'm supposed to write this down in code.</p>
  
  <p>this is my code so far;</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="ovning3-3.js"&gt;&lt;/script&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;&lt;/h1&gt;
  &lt;p&gt;
  
  &lt;/p&gt;
  
  
  &lt;input id="first" type="text"&gt;
  &lt;input id="second" type="text"&gt;
  &lt;input id="third" type="text"&gt;
  &lt;input type="button" value="Multiply" onclick="multiply()"&gt;
  &lt;input type="button" value="Divide" onclick="divide()"&gt;
  &lt;input type="button" value="Multiply and Divide" onclick="multiplyAndDivide()"&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and the java script;</p>
  
  <pre><code>function multiply() {
  
      var x = document.getElementById("first").value;
      var y = document.getElementById("second").value;
      var z = document.getElementById("third").value;
      var result = (x * y) * z
  
      alert(result)
  
  }
  
  function divide() {
  
      var x = document.getElementById("first").value;
      var y = document.getElementById("second").value;
      var z = document.getElementById("third").value;
      var result = (x / y) / z
  
      alert(result)
  
  }
  
  
  function multiplyAndDivide() {
  
      multiply();
      divide();
  
  }
  </code></pre>
  
  <p>Any help out there?</p>