Are you planning for an interview? Some most common JavaScipt interview questions you might face

Naim Morshed
4 min readMay 8, 2021

--

Photo by Christina @ wocintechchat.com on Unsplash

How does JavaScript work? Tell me some key features of JavaScipt.

How JavaScipt code executes?

What is the difference between recursion and iterate?

What is DOM?

When coding with React the first thing that pops up in our mind is what the heck is this DOM? Has this any sort of connection with dom? A host from Fast and the Furious. Sorry pal I am not talking about movies and fiction here. I am talking about Document Object Model. An interface for HTML and XML documents. You can think of a canvas where you can paint in your own way. Your own design, style, and structure. Similarly, DOM connects web pages with a scripting language. So to speak more politely DOM is the structure representation of all nodes in HTML and the programmer has that freedom to style, design, and code HTML documents in his/her own way by means of JavaScipt.

When and how to use the JavaScipt callback function?

What is the difference between Let & Var?

Have you ever heard something called ES6 in JavaScipt? ES6 or ECMAScript is another scripting language branch for JavaScipt. ES6 brings some major improvements in the JavaScipt language. Among them, ES6 introduced two new major enhancements called Let and Const keyword. This Let and Const is nothing just declarations of variables. Var has some drawbacks. When declared inside a scope, var leaks into another scope or parent scope. But Let and Const are free from this kind of scope leakage. When declared inside a scope let cannot be accessed from outside the scope. In one word the main difference between this two is existence. Let keyword has no existence outside the scope but Var has the existence and can be called from outside the scope.

What is the difference between the ES6 Arrow function and regular function?

Let first know how to write an arrow function. The function should be declared with either es6 let/const keyword and after that, there will be a name for the function, after that the parenthesis and enclosed by second brackets. [ const function_name = () => {} ]. Simple as that. So, have you ever imagined what can be the differences between a regular function and an arrow function? Both are served as a function, right? But what can be the mystery that an arrow function is differentiated by a regular function? Let’s point out some major differences.

  1. If the arrow function contains a single line or expression it can omit the function's curly braces.
  2. Regular functions can be used as a constructor but the Arrow function cannot be used as a constructor.
  3. Inside a regular function, you can use a special type of array-like object called arguments. But ES6 Arrow Functions do not support arguments special keyword.
  4. You can define methods inside the arrow function.

What is the purpose of New keyword in JS?

The new keyword lets developers create a new instance of user-defined or built-in objects. And also add a prototype to the newly created instance. Suppose you have a function or class called Animals. Inside Animal class/function there exist two more functions or variables. If you want to access those variables or functions you have to go through creating a new reference to that object. Let’s assume, [ const animal1 = new Animal(); ]

What is the purpose of This keyword in JS?

This keyword in JavaScipt refers to the object it belongs to. When inside a function or scope ‘this’ keyword is used, it will refer the elements inside to that function or scope. When used alone it will simply refer to the global object.

Can you differentiate between double equal and triple equal?

As a developer, you should be familiar with equal operator ‘=’. In most languages like Java, Python, Kotlin there exist a single equal operator which means equality between two values or objects. In JavaScipt there exist an extra equal operator which is double equal operator ‘==’. In this topic, we will figure out what’s the difference between these two equal operators. A single operator only equalizes the value inside of a variable it has no headache with the data type. Assume, “2” = 2; the answer is true. It will not figure what the data type is rather will deal only with the value. On another side, “2”==2, will return false because the double equal operator will deal with both value and data type.

Tell me some differences between bind, call & apply.

Some topics related to Asynchronous JS and tell me something setTimeout, setInterval.

What are an event bubble and event delegate? State some examples.

What is an API? Write something about API, GET, POST.

What are a window, global variable, and global scope?

Closure, Encapsulation, and private variable?

--

--

Naim Morshed
Naim Morshed

Written by Naim Morshed

Call me Naim your programmer friend who is always looking for solving challenging task and adapt with new technologies.

No responses yet