// your "ECMAscript" does not belong here...
var input = document.querySelector('.numberInput');
var para = document.querySelector('p');
//-moz:Let's add some useful functions! +sole:...
function squared(num) { return num * num; }
function cubed(num) { return num * num * num; }
function factorial(num) {
if (num < 0) return undefined;
if (num == 0) return 1;
let x = num - 1;
// ?
while (x > 1) {
num *= x;
x--; }
return num;
}
//-moz:Next, we're going to include a way to print out information about the number entered into the text input.
// Enter the following event handler below the existing functions:
input.addEventListener('change', () => {
var num = parseFloat(input.value);
if (isNaN(num)) { para.textContent = 'You need to enter a number!'; }
else {
para.textContent = num + ' squared is ' + squared(num) ;
para.textContent += num + ' cubed is ' + cubed(num) ;
para.textContent += num + ' factorial is ' + factorial(num) ;
}
});
//-moz:Save your code, load it in a browser,