What is the output of following code?var a = 10;function test() { a = 20;}test();console.log(a);Options: Pick one correct answer from below1020

Question

What is the output of following code?var a = 10;function test() { a = 20;}test();console.log(a);Options: Pick one correct answer from below1020
🧐 Not the exact question you are looking for?Go ask a question

Solution 1

The output of the code will be 20.

Here's the step by step explanation:

  1. The variable a is declared and initialized with the value 10 in the global scope.
  2. A function test() is declared which assigns the value 20 to the variable a.
  3. The function test() is called. This changes th Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study prob
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solv

This problem has been solved

Similar Questions

What is the output of following code?var a = 10;function test() { a = 20;}test();console.log(a);Options: Pick one correct answer from below1020

What will the following JavaScript code output?(function() { var a = b = 5;})();console.log(b);5ReferenceError: b is not definednullundefined

What is the output of this code?function myFunction(a) { console.log(a + b);}const b = 79;myFunction(10);

What will be the output of the following code?a = "abce" >= "abcdef"print(a)Options: Pick one correct answer from belowTrueFalseBoth A and BNone of the Above

What is the output of this code?const a = 12;function myFunction(a) { console.log(a);}myFunction(89);112289

1/3