Important JavaScript short-notes for a job interview.

Rafiul Hasan
3 min readMay 8, 2021

# Hoisting: Hoisting is JavaScript default behavior moving the declarations to the top. In other words, variables can be used before declarations.# This: This keyword indicates the object it belongs to.

# Scope: Scope determines the accessibility of variables, functions, or objects from different parts of the codes.

# Closure: A closure is a function having scope to the parent scope even parent function is closed.

# Null vs Undefined: Both are falsy but surprisingly both are not the same type though both are primitive types. Null should be declared as there is no value while undefined is a value that should exist but currently not available,

#Double and Tripe equal Difference: Double equal is a loose case which only checks the value is the same or not and ignores types where triple equal checks value and type also. The triple equal sign is for strict equality.

#Asynchronous JavaScript Event Loop: An event loop is a process that repeatedly checks is there anything on the call stack to execute until the call stack is empty. This task was done synchronously. But if there anything which is related to a timer or needs longer time to execute it will block other operation as halt call stack upon finishing the ongoing job. That is troublesome and halt UI. That’s why asynchronous JavaScrpt introduced. In asynchronous JavaScript, any time-consuming task stores on the Job queue and event look pay attention to the call stack. After finishing all the task stacked in the call stack it pays attention to the job queue and then executes it. It is called JavaScript non-blocking behavior.

#Event Bubble: Events are responsible to interact between JavaScript and HTML. This event listening flow moves up from children to its parent to the higher level. This process is called event bubbling. This bubble is moving up from parent to parent until handle.

#Stop Propagation and stop immediate Propagation: Method uses to halt the bubbling behavior of the event.

# Event Capture: Event capture is the opposite of the event bubble. It flows from up to down.

#Event Delegation: Event delegation is a process of using an event bubble to handle the event and assign an event listener to the higher level of dom instead of assign to the originator for the existing or future element.

# Recursive Function: Recursive function is a self-invoking function and continues until the stopping condition met.

#DOM: DOM is an object-oriented presentation of the webpage which can be modified such as update, delete, style, or make a structure with a scripting language.

#Call Back Function: If a function takes another function as an argument then it is called callback. After executing the first one then the second one executes. In this case, the function executes by a serial of call rather than define.

#Truthy or Falsy value: In JavaScript except false, 0,-0, ‘’/(empty string), null, undefined, NaN, 0n, document.all other values are truthy values.

#What Is API: API is a set of operations/software intermediary which help two application interact each other to run certain operation without knowing what is going under the hood.

# What is JavaScript: JavaScript is lightweight, just in time compiled, with the first-class function, supporting object-oriented, prototype-based, single-threaded programming language. JavaScript workflow…

Single thread > synchronous > call stack>run our code > global execution context> eventloop> web API > callstack again.

--

--