function init(){ var calcular = document.getElementById("calcular"); var x = document.getElementById("n1"); var y = document.getElementById("n2"); calcular.onclick = function() { x.textContent = parseInt(Math.random() * 10); y.textContent = parseInt(Math.random() * 10); calcular = parseInt(x.textContent) + parseInt(y.textContent); console.log("La suma de x más y: " + calcular); calcular = parseInt(x.textContent) - parseInt(y.textContent); console.log("La resta de x menos y: " + calcular); calcular = parseInt(x.textContent) * parseInt(y.textContent); console.log("La multiplicacion de x por y: " + calcular); calcular = parseInt(x.textContent) / parseInt(y.textContent); console.log("La division de x entre y: " + calcular); calcular = Math.pow(parseInt(x.textContent), parseInt(y.textContent)); console.log("x elevado a la potencia de y: " + calcular); calcular = parseInt(x.textContent) % parseInt(y.textContent); console.log("El resto de la división entera entre x e y: " + calcular); } }