Which type of scope allows a variable to be accessed from anywhere within the program?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
What happens if a variable is declared without the "var," "let," or "const" keyword?
What is the difference between "var" and "let" when it comes to variable hoisting?
What is the output of the following code snippet?
console.log(x);
var x = 5;
What is the output of the following code snippet?
function foo() {
console.log(x);
}
foo();
var x = 10;
What is the output of the following code snippet?
function foo() {
console.log(x);
}
foo();
let x = 10;
What is the output of the following code snippet?
var x = 5;
function foo() {
console.log(x);
var x = 10;
}
foo();
What is the output of the following code snippet?
var x = 5;
function foo() {
console.log(x);
}
foo();
What is the output of the following code snippet?
var x = 5;
function foo() {
console.log(x);
var x = 10;
function bar() {
console.log(x);
}
bar();
}
foo();
What is the output of the following code snippet?
var x = 10;
function foo() {
var x = 20;
function bar() {
var x = 30;
console.log(x);
}
bar();
}
foo();
What is the output of the following code snippet?
var x = 5;
function foo() {
console.log(x);
}
function bar() {
var x = 10;
foo();
}
bar();
What is the output of the following code snippet?
var x = 5;
function foo() {
console.log(x);
}
function bar() {
foo();
var x = 10;
}
bar();
What is the output of the following code snippet?
var x = 5;
function foo() {
console.log(this.x);
}
var obj = {
x: 10,
foo: foo,
};
var bar = obj.foo;
bar();
51 videos|28 docs|12 tests
|
51 videos|28 docs|12 tests
|