10 interview questions about javascript that every js developer should know.

A.K.M Fozlol Hoq
2 min readMay 8, 2021

1) null vs undefined

>> null means nothing. We assign null to a variable to denote that currently that variable does not have any value but it will have later on.

When we declare a variable but do not assign any value, then the default value of this variable is undefined.

2) truthy and falsy values

>> Truthy values are considered as true and falsy values are considered as false. In javascript,falsy values are:NaN, empty string, 0, false, null, undefined. Everything else is truthy values.

3) double equal vs triple equal

>> This is an extraordinary feature of javascript. We use double equal (==) to check between two variable's values(it will not check the type of that variable), but we can use triple equal ( === ) to check values with its type.

4) Default Parameters

>> We can use default parameters in js function like this:

function print( text=’text not sent’){
console.log(text);
}
print();
print(‘Hello world’);

output:
text not sent
Hello world

5) window, global variable

>> A global object is an object that always exists in the global scope. A window is a global object in the browser.

6) This keyword

>> In JavaScript, this keyword refers to the object where it is situated. Normally this keyword refers to the global object, but in a method, this keyword refers to the owner object. In an event, this keyword refers to that element that received the event.

7) Let, const, var

>> We use var to declare any variable. But in ES6, we use let or const. If we need to declare a variable that could be changed then we use let. If our needs a constant like PI or anything else, we use const.

8) Event bubble

>> When we click any button then an event occurs. If an event handler is set for that object, it will mount. If no handler is set for that event, the event bubbles up to the object's parent.

9) Document Object Model

>> 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.

10) API (Application Programming Interface)

>> An API (application programming interface) is an information gateway that allows the back ends of software and services to communicate with one another.

--

--