Some common and important JavaScript related Interview questions

What is javascript ?

JavaScript is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. This is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative styles.

How javascript code executes ?

Whenever a JavaScript program is run, an execution context is created. In this phase, javascript allocates the memory to all the variables and functions present in the program. The variables are stored with the value undefined and the function is stored with all the code present in that particular function.

How recursion works ?

A recursive function calls itself, the memory for a called function is allocated on top of memory allocated to calling function and different copy of local variables is created for each function call. When the base case is reached, the function returns its value to the function by whom it is called and memory is de-allocated and the process continues.

Recursion vs Iteration

The concept of Recursion and Iteration is to execute a set of instructions repeatedly. The difference between them is that recursion is simply a method call in which the method being called is the same as the one making the call while iteration is when a loop is repeatedly executed until a certain condition is met.

What is DOM ?

The Document Object Model (DOM) is a programming interface for HTML and XML documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects.

What is Callback Function ?

A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.

What are APIs ?

Application Programming Interfaces (APIs) are constructs made available in programming languages to allow developers to create complex functionality more easily. They abstract more complex code away from you, providing some easier syntax to use in its place.

What is Closure ?

A closure is the combination of a function enclosed with references to its surrounding state. In other words, a closure gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time.

Null vs Undefined

Null means an empty or non-existent value. Null is assigned and explicitly means nothing. while undefined typically means a variable has been declared but not defined yet.

Double equals (==) vs Triple equals (===)

Double equals (==) will perform a type conversion when comparing two things and will handle NaN, -0, and +0 (so NaN != NaN, and -0 == +0);

Triple equals ( === ) will do the same comparison as double equals (including the special handling for NaN, -0 and +0 ) but without type conversion; if the types differ, false is returned.

A curious Jr. Front End Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store