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

11. What is a promise in JS?
A Promise represents a value that may be available now, later, or never.
let promise = new Promise((resolve, reject) => {
resolve("Success");
});

Use .then() for success and .catch() for errors. 🤝

12. Explain async/await
async functions return promises. await pauses execution until the promise resolves. ▶️⏸️
async function fetchData() {
const res = await fetch('url');
const data = await res.json();
console.log(data);
}


13. What is the difference between call, apply, and bind?
- call(): Calls a function with a given this and arguments. 🗣️
- apply(): Same as call(), but takes arguments as an array. 📦
- bind(): Returns a new function with this bound. 🔗
func.call(obj, a, b);
func.apply(obj, [a, b]);
const boundFunc = func.bind(obj);


14. What is a prototype?
Each JS object has a hidden [[Prototype]] that it inherits methods and properties from. Used for inheritance. 🧬

15. What is prototypal inheritance?
An object can inherit directly from another object using its prototype chain.
const parent = { greet() { return "Hi"; } };
const child = Object.create(parent);
child.greet(); // "Hi"


16. What is the use of ‘this’ keyword in JS?
this refers to the object from which the function was called. In arrow functions, it inherits from the parent scope. 🧐

17. Explain the concept of scope in JS
Scope defines where variables are accessible. JS has:
- Global scope 🌍
- Function scope 🏛️
- Block scope (with let, const) 🧱

18. What is lexical scope?
A function can access variables from its outer (parent) scope where it was defined, not where it's called. 📚

19. What are higher-order functions?
Functions that take other functions as arguments or return them. 🎓
Examples: map(), filter(), reduce()

20. What is a pure function?
- No side effects 🚫
- Same output for the same input ✅
Example:
function add(a, b) {
return a + b;
}

💬 Tap ❤️ for Part-3!
  • ❤ 14
  • 😁 1
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 →