Thursday , September 19 2024

Analyze the code below: function test(counter) { console.log(“test”); if (counter > 0) test(–counter); } test(3); How many times will the word “test” be displayed in the console?

Questions BankCategory: JavaScript Essentials 1Analyze the code below: function test(counter) { console.log(“test”); if (counter > 0) test(–counter); } test(3); How many times will the word “test” be displayed in the console?
Analyze the code below:

function test(counter) {
    console.log("test");
    if (counter > 0)
        test(--counter);
}

test(3);

How many times will the word "test" be displayed in the console?

  • 2
  • 4
  • 3
  • 0

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