Good evening! I’m a beginner and I’m learning how to code a program that solves subtraction, multiplication, division, and addition.
Here’s what I have for multiplication.
Using eval is considered bad practice but in this case it might help you with your demo.
function calculate() {
var operator = document.getElementById('operator').value;
var value = eval(x.value + operator + y.value);
d.innerHTML = value;
}