Most Popular Javascript Interview Question for Junior Developer or Intern

MD AL MOTTAKI
3 min readMay 15, 2021

Truthy vs Falsy Value: Truthy value can be defined as if a variable has a true value and if a variable has a false value or undefined is called falsy value. An empty string, false, null are falsy value whether a true value like 10 or something else is a truth value

Null vs Undefined: When we define a variable and using it before assigning a value it is Undefined. If a function isn't return anything but we expect value from them then it is null.

Double Equal vs Tripple Equal: Both double and triple equal are relational operators but there are differences between them. Double equal check if the values are equal or not where triple equal check both values and types.

Scope, Block: Scope or Block is a place under loop or conditional statement. The statement or code won't execute without a satisfying loop or condition.

Closure: When a function calls another function inside from it, and the inner function uses the value from the outer function. Then the inner function makes a lexical reference.

Difference Between Bind, Call and Apply: Bind, Call and Apply both of them are used for using one object's function or method to another object. Bind returns a function and after storing that we can use it. Call and apply both can be used directly by passing another object and values for the function. Values for Call and Apply are separated by comma and array

Window, Global Variable, and Global Scope: A window is the place of a browser that holds all the documents of that webpage including DOM, function, method, etc. It is called Global scope also. All thing remains here is accessible from anywhere. All of the variables are global variables.

This keyword: Well this keyword is used to reference own class or own object. When a class inherits another class or an object uses another object's method this keyword is used to identify the exact class or object.

Asynchronous js, SetTimeOut,setInterval: Javascript is asynchronous in nature that means it executes one task or command at a time .setTimeOut denotes the delay for that task and the time measures in milliseconds and it executes the task exact one time whether setInterval denotes the interval between execution delay. setInterval executes command multiple times.

How Js Works: Javascript is asynchronous,single-threaded,non-blocking and it has an execution stack, Web API, processing queue, and event loop. When a command is given the js then push this command into the stack and it runs into the browser and if any command is related to the server and it will take more time js then transfer this command into web API. Here web API is working as a core and transfer this result into task queue and task queue check if the callback stack is empty or not, if the stack is empty then event loop transfers the result one at a time and stack execute it.

API, GET, POST: API(Application Programming Interface) is used to communicate with the database. Generally GET is used to read data from the database, also we can send data via URL parameter and the text limit is 2048 characters. POST is used to post data in the database. Data is send using the body and the format is a string.

Js Callback: When a function is passed as an argument of a function then the passed function is called a callback function. Though javascript executes the command sequentially, with the use of async and await a callback function can run after executing the main function.

DOM: DOM(Document Object Method) is a browser place where HTML and XML run. All documents (HTML, XML) are treated here as a tree. The browser doesn't support any language except HTML. We can change documents body, content, style by using DOM API.

Event Bubble: Event bubbles are used to capture the exact event from the exact element. Event bubble goes upwards from node to parent node to Grand Parent Node. After getting the exact node or exact event it can be stopped by using stopPropogation and stopImmediatePropogation .

Let, Const Array and Object: ES6(ECMAScript) introduced us to Let and Const after the typical variable declaration method var. Var is used to declare a variable globally which is problematic for large applications whether the let const methods are scope or block variable. If we use them in a block we can't access them from outside. If we declare an array with let we can change its datatype and change its total content. But when we declare an array with cont we can add delete its content but can't change its total content

--

--