TGViewer
Programming Books Programming Books @programmingbooksofficial ยท 379 subscribers
Post #400 133
๐Ÿš€ JavaScript Interview Questions with Answers โ€” Part 1

1. What is JavaScript?

JavaScript is a high-level, interpreted programming language used to create interactive and dynamic web pages. It runs in web browsers and can also be used for backend development with Node.js.

Common Uses:

Interactive websites

Form validation

Animations

API calls

Web applications

Backend development

Example:

console.log("Hello JavaScript");


2. What are the different data types in JavaScript?

JavaScript has two categories of data types.

Primitive Data Types

String

Number

Boolean

Undefined

Null

BigInt

Symbol

Non-Primitive (Reference) Data Types

Object

Array

Function

Example:

let name = "Deepak";   // String
let age = 25; // Number
let isActive = true; // Boolean
let data = null; // Null
let value; // Undefined


3. What is the difference between var, let, and const?

Feature | var | let | const

Scope | Function | Block | Block

Reassign | โœ… Yes | โœ… Yes | โŒ No

Redeclare | โœ… Yes | โŒ No | โŒ No

Hoisted | โœ… Yes | โœ… Yes (TDZ) | โœ… Yes (TDZ)

Example:

var a = 10;
let b = 20;
const c = 30;


Interview Tip:

Use const by default, let when the value changes, and avoid var in modern JavaScript.

4. What are primitive and non-primitive data types?

Primitive Data Types

Stored by value.

Examples:

String

Number

Boolean

Null

Undefined

BigInt

Symbol

Non-Primitive Data Types

Stored by reference.

Examples:

Objects

Arrays

Functions

Example:

let a = 10;
let b = a;
b = 20;

console.log(a); // 10


Reference Example:

const obj1 = { name: "John" };
const obj2 = obj1;
obj2.name = "Mike";
console.log(obj1.name); // Mike


5. What is type coercion?

Type coercion is JavaScript's automatic conversion of one data type into another during operations or comparisons.

Example:

console.log("5" + 2); // "52"
console.log("5" - 2); // 3


Types:

Implicit coercion (automatic)

Explicit coercion (manual)

Explicit Example:

Number("10"); // 10
String(100); // "100"


6. What is the difference between == and ===?

== (Loose Equality)

Compares values only

Performs type conversion

=== (Strict Equality)

Compares both value and data type

No type conversion

Example:

console.log(5 == "5");   // true
console.log(5 === "5"); // false


Best Practice:

Always prefer === to avoid unexpected results.

7. What are truthy and falsy values?

Truthy Values

Values treated as true in a boolean context.

Examples:

Non-empty strings

Non-zero numbers

Objects

Arrays

Falsy Values

JavaScript has these falsy values:

false

0

-0

0n

"" (empty string)

null

undefined

NaN

Example:

if ("Hello") {
console.log("Truthy");
}
if (0) {
console.log("Won't execute");
}


8. What is undefined?

undefined means a variable has been declared but has not been assigned a value.

Example:

let value;
console.log(value);


Output:

undefined

Key Point:

undefined is assigned automatically by JavaScript.

9. What is null?

null represents an intentional absence of any object value.

It is assigned manually by the developer.

Example:

let user = null;
console.log(user);


Output:

null

Difference:

undefined โ†’ No value assigned.

null โ†’ Empty value assigned intentionally.

10. What is NaN?

NaN stands for Not a Number.

It represents an invalid numeric result.

Claim your Free $5 Bonus Here:
https://bit.ly/3wUxw09

LinkedIn profile ๐Ÿ‘‡

https://www.linkedin.com/in/subarno-roy-3b2251374


1๏ธโƒฃ Artificial Intelligence
๐Ÿ“Ž Channel Link:
[ https://t.me/artificialintelligence_official ]

2๏ธโƒฃ Programming Books
๐Ÿ“Ž Channel Link:
[ https://t.me/programmingbooksofficial ]

3๏ธโƒฃ Android Development
๐Ÿ“Ž Channel Link:
[ https://t.me/androiddevelopmentofficial ]

4๏ธโƒฃ App Development
๐Ÿ“Ž Channel Link:
[ https://t.me/appdevelopmentofficial ]

5๏ธโƒฃ Ethical Hacking
๐Ÿ“Ž Channel Link:
[ https://t.me/ethicalhacking_official ]
More from @programmingbooksofficial
  1. Oct 8, 2026INDIA'S BIGGEST SHOPPING SALE IS LIVE TOMORROW IS IT REALLY A DEAL๐Ÿคก? THIS APP BUYHATKE TEโ€ฆ
  2. Oct 3, 2026๐—ง๐—ต๐—ผ๐˜€๐—ฒ ๐˜„๐—ต๐—ผ ๐˜„๐—ฎ๐—ป๐˜ ๐—ฟ๐—ฒ๐—ณ๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—น๐˜€ ๐—ฎ๐—ป๐—ฑ ๐—๐—ผ๐—ฏ๐˜€ ๐—ฎ๐—ป๐—ฑ ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐—ป๐˜€๐—ต๐—ถ๐—ฝ๏ฟฝโ€ฆ
  3. Sep 30, 2026โค๏ธ Here is the list of highly recommended Telegram channels for your free learning โค๏ธ Getโ€ฆ
  4. Sep 27, 2026๐Ÿšจ Earn Passive Money Easily ๐Ÿšจ Since your device is already connected to the internet, yoโ€ฆ
  5. Sep 26, 2026Hackathon National Research & Innovation Challenge Season 3 ๐Ÿ“ŒAPPLY LINK : https://bit.ly/โ€ฆ
  6. Sep 13, 2026Data analytics is not about the the tools you master but about the people you influence. Iโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’