1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which keyword is used to declare a block-scoped variable in JavaScript?
What is the difference between var and let in terms of hoisting?
What is the output of the following code?
console.log(x);
var x = 5;
What is the output of the following code?
function example() {
console.log(x);
var x = 10;
}
example();
What is the output of the following code?
console.log(a);
let a = 7;
What is the output of the following code?
function example() {
console.log(a);
let a = 3;
}
example();
What is the output of the following code?
var x = 5;
(function () {
console.log(x);
var x = 10;
})();
What will be the value of "result" after executing the following code?
var x = 2;
(function () {
x = 5;
})();
var result = x * 3;
What is the value of "sum" after executing the following code?
var sum = 0;
for (var i = 0; i < 5; i++) {
sum += i;
}
console.log(i);
What is the output of the following code?
function outer() {
var x = 1;
function inner() {
console.log(x);
}
x = 2;
return inner;
}
var fn = outer();
fn();
What is the value of "result" after executing the following code?
function multiplyByTwo(num) {
var result = num * 2;
return function () {
console.log(result);
};
}
var multiplyByTwoFn = multiplyByTwo(5);
multiplyByTwoFn();
51 videos|28 docs|12 tests
|
51 videos|28 docs|12 tests
|