JavaScript calculator using inputs value I’m trying to make a simple calculator with 3 inputs in JavaScript but it doesn’t work. For now my code is:

&lt;html&gt;
&lt;input placeholder="Number" id="Number F” class="Number F" onchange="calculator()"&gt;
&lt;input placeholder="/ ,  * ,  -  or +" id="Number O" class="Number O" onchange="calculator()"&gt;
&lt;input placeholder="Number" id="Number S" class="Number S" onchange="calculator()"&gt;
&lt;p id="resul"&gt;&lt;/p&gt;
&lt;button id="button" onclick="calculator()"&gt;&lt;/button&gt;
&lt;script&gt;
function calculator() {
  var cel = document.getElementById("Number F").value;
  var celular = document.getElementById("Number S").value;
  var operator = document.getElementById("Number 0").value;
  var result = document.getElementById("resul").innerHTML;
  var getAverage = (numberOne, numberTwo) =&gt; {
    const average = numberOne / numberTwo;
    result = average;
    if (operator === "+" || operator === "/" || operator === "-" || operator === "*") {
       getAverage(cel, celular);
     } else {
};

&lt;/script&gt;
&lt;/html&gt;


I’m beginner in coding. What is wrong? Please Help Me! Thank you!
Id attribute cannot contains spaces.

You can also use an object which contains the function's definition for all the possible operations.

var operators = {
  '+': function(a, b) { return +a + (+b) },
  '-': function(a, b) { return a - b },
  '/': function(a, b) { return a / b },
  '*': function(a, b) { return a * b },
};




var operators = {
    '+': function(a, b) { return +a + (+b) },
    '-': function(a, b) { return a - b },
    '/': function(a, b) { return a / b },
    '*': function(a, b) { return a * b },
};
function calculator() {
  var cel = document.getElementById("NumberF").value;
 var celular = document.getElementById("NumberS").value;
  var operator = document.getElementById("NumberO").value;
  var result = document.getElementById("resul");
  if(cel &amp;&amp; celular &amp;&amp; operator)
    result.innerHTML = operators[operator](cel, celular);
};
&lt;input placeholder="Number" id="NumberF" class="NumberF" onchange="calculator()"&gt;
&lt;input placeholder="/ ,  * ,  -  or +" id="NumberO" class="NumberO" onchange="calculator()"&gt;
&lt;input placeholder="Number" id="NumberS" class="NumberS" onchange="calculator()"&gt;
&lt;p id="resul"&gt;&lt;/p&gt;
&lt;button id="button" onclick="calculator()"&gt;Click&lt;/button&gt;