Guest practice: this set is not saved and does not count.
Writing a function definition runs the code inside the function right away.
What does this log?
function square(n) { return n * n; } function hypotenuse(a, b) { return Math.sqrt(square(a) + square(b)); } console.log(hypotenuse(6, 8));
What happens when this runs?
console.log(cube(2)); const cube = function (n) { return n * n * n; };
8
undefined
NaN
ReferenceError
btn.addEventListener("click", showMenu()); runs showMenu once when the page loads, not when the button is clicked.
btn.addEventListener("click", showMenu());
showMenu
function describe(name, age) { return name + " is " + age; } console.log(describe(16, "Sam"));
Click a question to go back and check it. After you submit, you will see the right answer and an explanation for every question. As a guest, nothing is saved.
Check my answers