My Interview preparation with JavaScript

You have to always be ready with JavaScript if you looking for a developer Job. Because no matter what language you like most or you learned most. They're always at least a question related to JavaScript. Because it is one of the top programming languages. In this blog, I will share some interview-focused tips and also some most common JavaScript questions. so let's get started…

  1. Truthy and Falsy Values

You should focus on some areas which parts are important for the Interview but not for the development first stage of your learning JavaScript language. So for that, the first important topic is truthy and falsy values. In JavaScript, a truth value is a value that is considered true when encountered in a boolean context. All Values are truth unless they are defined as falsy. Example: except for false, 0, -0, ’’’, null, undefined, and NaN.

2. Null Vs Undefined

null is a special value meaning “no value”. null always returns type ‘object’. Because it is a special object. On the other side, undefined means that the variable has not been declared, or has not been given a value.

3. double equal (==) vs triple equal (===)

tiple equal (===) will do that same comparison double equals. But there is a difference between these two. Which type of conversation. Yes, triple equal (===) also check the type of the value you have given but double (==) unable to do that. Because of that double qual and triple equals are different.

4. Global variable and Global scope

A variable declared outside a function becomes Global. And a global variable has global scope. Example of nonglobal variable:

// code here can NOT use fruitName

function myFunction() {
var fruitName= "Apple";

// code here CAN use fruitName


Example of Global variable:

var fruitName= "Apple";

// code here can use fruitName

function myFunction() {

// code here can also use fruitName


5. this keyword

I had serious trouble learning this keyword. Because this keyword behaves a little differently in JavaScript compared to other languages. It also has some differences between strict mode and non-strict mode. Most of the time, the value of this is determined by how a function is called. It can’t be set by assignment during execution, and it may be different each time the function is called.

6. setTimeout and setInterval

setTimeout and setInterval both are almost the same. But the code is executed multiple times in setInterval. If you want to kill the timer you have to call clearInterval. In JavaScript, setTimeout and setInterval are the only native functions to execute code asynchronously.

7. Event bubbling

Event bubbling is a term you might have come across in your JavaScript learning process. When one element is nested inside a second element, and both elements have registered a listener for the same event then event bubbling relates to the order in which event handlers.

8. Arrow function

The arrow function is cleaner, shorter, and more readable than the normal function. Yes, it also hard to understand for the beginners like me. But you have to and should learn to write code smartly. Arrow Function example:

const friends = [{
name: "Alex", phone:657849
name:"Jhon", phone:4654154

9. Difference between bind, call and apply

The bind method creates a copy of the function and sets this keyword, while the call and apply methods set this keyword and calls the function immediately.

10. Event Loop

Actually, how does JavaScript Works? Yes when we started learning JavaScript, every curious developer want to know this after a while. So JavaScript event loop has a concurrency model, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks.

that's all for today, I just express what topics I keep in my mind before going for interviews. hope you will find something helpful from this blog.

My name is Shariful Pradhan Hridoy. I am a Web Developer, and I'm very passionate and dedicated to my work. With wide experience as a React Web developer.