TGViewer
Web Development - HTML, CSS & JavaScript Web Development - HTML, CSS & JavaScript @javascript_courses · 55.7K subscribers
Post #3161 7K
✅ Top Javascript Interview Questions with Answers: Part-1 💻✨

1. What are the key features of JavaScript?
- Lightweight, interpreted language
- Supports object-oriented and functional programming
- First-class functions
- Event-driven and asynchronous
- Used primarily for client-side scripting but also server-side (Node.js)

2. Difference between var, let, and const
- var: Function-scoped, hoisted, can be redeclared
- let: Block-scoped, not hoisted like var, can't be redeclared in same scope
- const: Block-scoped, must be initialized, value can't be reassigned (but objects/arrays can still be mutated)

3. What is hoisting?
Hoisting means variable and function declarations are moved to the top of their scope during compilation.
Example:
console.log(a); // undefined
var a = 10;


4. Explain closures with an example
A closure is when a function retains access to its lexical scope even when executed outside of it.
function outer() {
let count = 0;
return function inner() {
return ++count;
};
}
const counter = outer();
counter(); // 1
counter(); // 2


5. What is the difference between == and ===?
- == (loose equality): Converts operands before comparing
- === (strict equality): Checks type and value without conversion
'5' == 5 // true
'5' === 5 // false

6. What is event bubbling and capturing?
- Bubbling: Event moves from target to top (child → parent)
- Capturing: Event moves from top to target (parent → child)
You can control this with the addEventListener third parameter.

7. What is the DOM?
The Document Object Model is a tree-like structure representing HTML as objects. JavaScript uses it to read and manipulate web pages dynamically.

8. Difference between null and undefined
- undefined: Variable declared but not assigned
- null: Intentionally set to "no value"
let a; // undefined
let b = null; // explicitly empty

9. What are arrow functions?
Concise function syntax introduced in ES6. They do not bind their own this.
const add = (a, b) => a + b;

10. Explain callback functions
A callback is a function passed as an argument to another function and executed later.
Used in async operations.
function greet(name, callback) {
callback(Hello, ${name});
}
greet('John', msg => console.log(msg));


💬 Tap ❤️ for Part-2!
  • ❤ 31
More from @javascript_courses
  1. Oct 9, 2026🇮🇳 𝗚𝗢𝗩𝗘𝗥𝗡𝗠𝗘𝗡𝗧 𝗢𝗙 𝗜𝗡𝗗𝗜𝗔 — 𝗔𝗜𝗖𝗧𝗘 𝗜𝗡𝗧𝗘𝗥𝗡𝗦𝗛𝗜𝗣𝗦 𝟮𝟬𝟮𝟲 🚀…
  2. Oct 8, 2026🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥 Upgr…
  3. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  4. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
  5. Oct 4, 2026DSA Handwritten Notes
  6. Sep 28, 2026To learn web design and development from basic to advanced levels, you can follow these st…
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 →