Top Ten Things Beginners Must Know About JavaScript for Interviews

Arafat Hosain
3 min readMay 8, 2021

Truthy vs Falsy values in JavaScript

If you are someone who codes in JavaScript you are well aware of the if/else function. So what this function does it determines a value is true or false according to the measurement you set yourself!

The following values are always falsy:

1. false

2. 0 (zero)

3. ‘’ or “(empty string)

4. Null

5. Undefined

6. NaN

Everything else is truthy. That includes:

1. ‘0’ (a string containing a single zero)

2. ‘false’ (a string containing the text “false”)

3. [] (an empty array)

4. {} (an empty object)

5. function(){} (an “empty” function)

What is JavaScript, key features of JavaScript?

JavaScript is the most popular language in the world right now! It can be used in client-side and server-side, both! A huge percentage of websites in the world right work with JavaScript!

Some Key Feature of the JavaScript is:

· It is a light language

· Dynamic Typing

· Object-oriented programming support

· Functional Style

· Platform Independent

· Prototype-based

· Interpreted Language

· Client-Side Validation

· More control in the browser

What is DOM (Document Object Model?)

DOM means Document Object Model.It is a programming interface for HTML and XML documents. It structures each page as a component like a tree .it is easier to access and manage!

What is an API, the purpose of API?

API means Application Programming Interface. It allows you to function across other software and different components!

Basically, it delivers a response to the server and the server sends back the response to the client! The user clicks and server responses show results in UI!

What is the difference between null & undefined?

When you declare a variable but you don’t assign it any value it becomes ‘Undefined’. But Null is assigned a value but it means nothing! It’s assigned an empty value! Undefined is a type but Null is an object!

What do you understand by NaN?

NaN basically means Not a Number! The basic definition of NuN is that when an operation is executed it returns a value that is not presentable!

A little bit about scope in JavaScript

It is a strong and new feature of JavaScript! It is very complex to understand the scope clearly but I will try to clarify as much as possible! The scope is when you can access a specific portion of code with all variables and functions during runtime!

There are three types of scope in JavaScript:

* Global Scope

* Local or Function Scope

* Block Scope

Global Scope

The global space is easy to understand! When you write any JavaScript in the program, it is automatically taken as global scope! But A variable is in the global scope of its outside the function!

Local Scope

Any Variables that you declare inside a function considered as a Local scope! It means any variables that are in the local scope can not be accessed from outside!

Block Scope

The black scope is only when you use let and constant. If you declare a value with a bar, it can’t be considered as block scope! Any variable inside a block can be only accessed from the block from not outside!

--

--