Signup/Sign In

Guess the Output - Part 1 Test

JavaScript Avg. Score: 1.65 374 Beginner
Q.1 What will be the output of the following code snippet?
var p = 7;
function func() {
    console.log(p);
    var p = 14;
}
func();
Q.2 What will be the output of the following code snippet?
var a = 10;
function outer() {
  var a = 20;
  function inner() {
    console.log(a);
  }
  inner();
}
outer();
Q.3 What will be the output of the following code snippet?
function subtract(a, b) {
  return a-b;
}
console.log(subtract(3, 2, 3));
Q.4 What will be the output of the following code snippet?
var arr = [1, 2, 3];
arr[10] = 10;
console.log(arr.length);
Q.5 What will be the output of the following code snippet?
console.log(2 + "2" - 1);

Studytonight logo

Find me on YouTube

I make videos for Fullstack Dev, AWS, Ethical Hacking and Foundational stuff.