JS Que & Ans
JS Que & Ans
+91-7260058093
www.algotutor.io
1. What Features Have Been Introduced In The ES6
Version?d Time
Let And Const Keywords.
Arrow Functions.
Multi-Line Strings.
The Destructuring Assignment.
Enhanced Object Literals.
Promises.
x = 5;
var x;
(function fun() {
{
let x = 1;
x++;
console.log(x);
}
console.log(x);
})()0;
// output
2
5
9. What Will Be The Output Of The Code Below?
setTimeout(() => {
console.log("Hi");
}, 0)
console.log("Hello");
// output
Hello
Hi
var x = 5;
x = 0;
setTimeout(() ={
console.log(x);
})
console.log("Hello");
x = x+1;
// output
Hello
1
10. What Will Be The Output Of The Code Below?
fun2();
console.log(x); console.log(y);
fun1();
const fun1() => {
console.log("fun1")
}
function fun2(){
console.log("fun2")
}
var x = 5;
Let y = 7;
// output fun2
undefined
ReferenceError: Cannot access 'y' before
initialisation
ReferenceError: Cannot access 'fun1' before
initialisation