Most Important JavaScript Questions

Minhazul Abedin
1 min readMay 16, 2021

###Question No : 1. About Undefined & Null:

Undefined::::
1. If a variable declare, but value doesn’t set in that variable. then, It’s Undefined. example, let mithu; console.log(mithu) >>> Undefined.
2. If a function isn’t return anything. then It’s Undefined. Example,
function add(num1, num2){
console.log(num1 + num2);
}

console.log(add(13, 26)); >>> Undefined.
3. In a function, parameter set, but function calling time, it’s not pass, at this time it’s Undefined. example,
function pakhi (num1, num2){
console.log(num1, num2);
}

console.log(add(34)); >>> Undefined. because, 2nd parameter empty.
4. In Object or Array, you want to access a value, but it’s not available in that object. for this case, it’s Undefined. example,
const meena = {name: “meena”, son: “Mithu”, husband: “mannan”};
console.log(meena.brother); >>> Undefined.

5. If you define a variable with an Undefined reserve keyword. then it’s obviously Undefined. example, let fun = undefined.

Null::::
1. Null means it’s empty or not exist.

###Question No : 2. Double equal vs Tripple equal:
1. double equal(==): For comparison, It checks only value. variable type doesn’t fact for this case.
2. Tripple equal(===): For comparison, It checks not only value but also their type. if, type & value both are the same, then it returns True.

###Question No : 3. Difference between global & local.
A global variable has a global scope. It can be defined anywhere in your JavaScript code. But, a local variable is available only in a scope, where it’s defined.

###Question No : 4. What is this keyword?

--

--