3. What are Arrow function?
Though we have shown an example about arrow functions in last example, let’s talk about it now. Usually while declaring a function, you had to name it first and to get a return type you had to specify that as well. But arrow functions help you to work in a easier way with less codes. Let’s see a code example, regular functions vs arrow functions —
Now the same code with arrow function —
4. What are for off & for in loop?
With ES6, new types of loop came which are for/of and for/in. This helps you to loop through iterable objects. Now there is significant difference between which one to use where. The for/of loop is for iterating value of an iterable (array, string) and for/in loop is for iterating through the keys of an object.
Let’s see an example for each of them —
5. What is the difference between == & ===?
6. What is NaN?
NaN is a property that denotes a result that is not a number. It is a property of the global object. In other words, it is a variable in the global scope. The isNaN() is a function that determines whether a value is an illegal number or not. When the function finds a value of that condition it returns true, false otherwise.
7.What is Truthy and Falsy Value?
And anything except these are truthy.
8.What is destructure?
ES6 introduces data destructuring that helps to unpack values from array and objects.
9.What is the difference between Null vs Undefined?
If you focus on the two names you will get a basic idea about this two. Null represents nothing. This means if you declare a variable with a value of null that means you declared a variable which has no value.
But undefined is different from this. It tells us that something is not defined. When you declare a variable without assigning a value then it will return undefined.