← Back to JavaScript Course | Chapter 12: Reference & Interview | Lesson 5 of 9

JS इंटरव्यू सवाल

Interview questions वे classic सवाल हैं जो लोगों से JavaScript jobs के लिए apply करते समय पूछे जाते हैं। इन्हें practice करना किसी नाटक से पहले lines को दोहराने जैसा है।

Basic Interview Questions

आम शुरुआती interview questions var/let/const के बीच फर्क, == === से कैसे अलग है, और undefined और null का असल में क्या मतलब है जैसी fundamentals जांचते हैं, क्योंकि ये दिखाते हैं कि किसी की basics पर पकड़ असल में कितनी मजबूत है।

उदाहरण: Basic Interview Questions

javascript
console.log(typeof undefined, typeof null); // classic var/let/const & null-vs-undefined question
console.log(1 == "1", 1 === "1");

Functions और Scope

Function और scope के सवाल अक्सर आपसे closures, hoisting, या अलग-अलग call contexts में this क्या refer करता है यह समझाने को कहते हैं — ऐसे क्षेत्र जहाँ JavaScript का व्यवहार कई developers को हैरान कर देता है।

उदाहरण: Functions and Scope

javascript
function outer() {
  let count = 0;
  return () => ++count; // closures question
}
const counter = outer();
console.log(counter(), counter());

Arrays और Objects

Array और object के सवाल आमतौर पर map/filter/reduce से data manipulate करने, shallow बनाम deep copies समझाने, या reference बनाम value semantics वाले output का अंदाज़ा लगाने से जुड़े होते हैं।

उदाहरण: Arrays and Objects

javascript
const nums = [1, 2, 3];
const doubled = [...nums].map(n => n * 2); // shallow copy question
console.log(nums, doubled);

Async JavaScript

Async JavaScript के सवाल आमतौर पर event loop, microtasks और macrotasks के बीच फर्क, और callback-based या Promise-chain code को async/await में बदलने को कवर करते हैं।

उदाहरण: Async JavaScript

javascript
console.log("1");
setTimeout(() => console.log("2 - macrotask"), 0);
Promise.resolve().then(() => console.log("3 - microtask"));
console.log("4"); // classic event loop ordering question

Coding Interview Practice

इन concepts को मिलाने वाली timed coding problems की practice करना — सिर्फ उनके बारे में पढ़ना नहीं — असल में वह speed और confidence बनाता है जो एक live interview में चाहिए होता है।

उदाहरण: Coding Interview Practice

javascript
// Define the function `getValue` taking `cb`
// Define the function `getValue` taking `cb`
function getValue(cb) { setTimeout(() => cb(42), 100); }
// Define the asynchronous function `getValueAsync` with no parameters
// Define the asynchronous function `getValueAsync` with no parameters
async function getValueAsync() {
  // Return `new Promise(resolve => setTimeout(() => resolve(42), 100))` from this function
  // Return `new Promise(resolve => setTimeout(() => resolve(42), 100))` from this function
  return new Promise(resolve => setTimeout(() => resolve(42), 100));
}
// Call `getValueAsync().then(v => console.log(v))`
// Call `getValueAsync().then(v => console.log(v))`
getValueAsync().then(v => console.log(v));
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. यह कहना कि typeof null "null" है, जबकि यह "object" है, एक well-known quirk।
  2. type coercion explain किए बिना यह answer देना कि == और === अलग हैं, जैसे "5" == 5 का true होना।
  3. closures या this की definition रट लेना बिना कोई छोटा example दिखा पाने के।
🔒

Chapter Quiz — Complete all 9 topics to unlock

0/9 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.