JavaScript most ask question

Md shahinur khan
3 min readMay 8, 2021

What is true and false value?

A boolean value is true or false. Every number is true other than 0, Every String is true other than an empty string.

// 0, null, nan, undefined are false values

// ‘0’, ‘ ’ are true

What is Double equal == and Triple equal === different?

Double == check value not check type. Triple=== equal check value and also type

Double equal Example:

let num = 2;

let string = ‘2’;

if(num==string){

console.log( “it’s true”)

}else{

console.log(“its false”)

}

//expected result: it's true

Triple equal Example:

let num = 2;

let string = ‘2’;

if(num===string){

console.log( “it’s true”)

}else{

console.log(“it’s false”)

}

//expected result:it’s false

What are scope and hoisting?

local variable and local function are only accessible inside the scope you cannot access them outside of the scope, var d = 3 you can access anywhere in your application, and in this variable use in local scope like the inside function you can not access outside of a function, it accesses local inside of a function.

Bind, call, apply?

when you use a method, again and again, you can use bind, call, apply. Any object has a method, if I use this method in another object I can use call, apply, bind. call work call this method after method call pass argument(which object you work) and after all parameters separate by comma, apply use in same but when you set this object after you pass method parameters as an array

What is JavaScript ?

Javascript is a Scripting and programming language, that you make web easily. You create dynamic web site using javascript. Javascript has many core functionality you knowing this. It is a client-side as well as a server-side language. It has a vast amount of features like dynamic programming, prototype-based object-orientation, and first-class functions

What is DOM?

DOM full meaning is Document Object Model. DOM is a programming interface documents for Html and Xml. Every web page have a document. This document can be displayed in the browser. Web page can be modified with a Scripting language such as Javascript .

What is different var, let, const?

var is a global scope, let and const are block scope. var can be updated and re-declared in scope. let variable can be updated but not re-declared. const variable can not be updated or re-declared.

How Javascript works event loop stack and queue?

The event loop continuously checks the call stack to see if there’s any function that needs to run. While doing so, it adds any function call it finds to the call stack and executes each one in order.

How reverse a string?

Example :

let reversedString= (str)=>{

let reverse = ‘’;

for (let i = 0; i < str.length; i++) {

const char = str[i];

reverse = char + reverse;

}

return reverse;

}

let string1 = ‘Reverse a String’;

let result = reversedString(string1);

console.log(result);

//expected result: gnirtS a esreveR .

Create a Factorial in recursive way ?

factorial Example:

function factorial(n){

if(n==0){

return 1;

}

else{

return n * factorial(n-1)

}

}

let check=factorial(10)

console.log(check);

//expected: 3628800

--

--