1
I don’t know if it would work, or if it would be the best option, but I have a code that consists of the following:
Situating that the value operacao
come up with the argument +
, and I want to use it to add up two values. As I should do?
Example:
function calcular(operacao){
var num1 = 6, num2 = 2;
var resultado = num1 + operacao + num2;
mostrarVisor(resultado);
}
function mostrarVisor(result){
document.getElementById('visor').innerHTML = result;
// aqui eu escrevo o resultado na tela!
}