Thursday , September 19 2024

Review the following code: let x = 10; let y = 20; function test(y) { console.log(y); } test(x); What will be displayed in the console as a result of its execution?

Questions BankCategory: JavaScript Essentials 1Review the following code: let x = 10; let y = 20; function test(y) { console.log(y); } test(x); What will be displayed in the console as a result of its execution?
Review the following code:

let x = 10;
let y = 20;

function test(y) {
    console.log(y);
}

test(x);

What will be displayed in the console as a result of its execution?

  • "y"
  • 20
  • 10
  • Nothing, because the function expects the y variable to be passed and receives x instead.

More Questions: JavaScript Essentials 1 – JSE1: Module 5 Test