JavaScript question that you must know

kanon chakma
2 min readNov 5, 2020

1.Difference between “==” and “===”
Abstract equality(==)and strict equality(===) Both are used to compare two variable.
“==” compare the variable but ignore variable datatype
“===”compare the variable and check also datatype

2.Scope
An area where we can access variable or function.There types of scope there:
Global scope:Globally declared variable or function that we can access every where in code.
Function scope:Inside function variable and function,parameter declared that are accessible only inside the function.
Block scope:Variable declared within a block({}) that access only this block.

3.falsy values in JavaScript
i. “”
ii.0
iii.null
iv.undefined
v.NaN
vi.false

4.Template Literals
A way of creating string.we will use back-quote instead of using single or double quote.
Advantages of that we can set value dynamically that are not possible in general string.

5.IIFE
Immediately Invoked Function Expression that are executed after declaration;
syntax look like (function(){})(). Whole function are wrapped with () and invoke also another parentheses();

6.var ,let and const
var are function scoped.
let are block scope and can be changes.
const are block scope but cannot be changes.

7.Arrow function
A way making function without function keyword that give cleaner syntax and don’t need a return statement.
In arrow function need only parentheses (). In cannot access arguments object and doesn’t have their own this value.

8.Spread operator and rest operator
Both are the same operator …
Difference is that spread operator spread individual data of an array.
But rest operator get all element and put then in an array.

9.undefined and null
when we don’t assign any value in variable and exist default value in variable that are undefined.
function when doesn’t return anything that are undefined.
In object does not property but if we try access it will give undefined.

null means nothing in the variable.

10. Event Bubbling
If an event occur on an element its goes to parent element,then its grandparents,and also until reach the window.

--

--