// Practice Set · JS Functions · guest

Guest practice: this set is not saved and does not count.

Question 1 of 5 from: Function Path

Writing a function definition runs the code inside the function right away.

Question 2 of 5 from: Function Intro

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));
Question 3 of 5 from: Function Invocation

What happens when this runs?

console.log(cube(2));
const cube = function (n) {
  return n * n * n;
};
Question 4 of 5 from: Function Invocation

btn.addEventListener("click", showMenu()); runs showMenu once when the page loads, not when the button is clicked.

Question 5 of 5 from: Function Parameters

What does this log?

function describe(name, age) {
  return name + " is " + age;
}
console.log(describe(16, "Sam"));
Ready to submit?

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.