Javascript Questions Answers Hinglish
Javascript Questions Answers Hinglish
2. JavaScript me 6 main data types hote hain: String, Number, Boolean, Undefined, Null, aur Object.
3. 'var' ka use purani JavaScript versions me hota tha, jo function scope ke saath aata tha. 'let' aur
'const' block-scoped hote hain. 'const' ka use constant values ke liye kiya jata hai.
4. JavaScript me function define karne ke liye 'function' keyword ka use kiya jata hai, jaise: function
myFunction() { // code }
5. Arrow functions concise syntax provide karte hain aur 'this' keyword ko lexical scope se inherit
6. Hoisting kya hota hai? Yeh kis type ke variables par hota hai?
6. Hoisting ek JavaScript behavior hai jisme variables aur functions ko unke declaration se pehle
7. Closures wo function hote hain jo apne outer function ke variables ko access kar sakte hain even
after the outer function has finished executing.
8. Higher-order functions wo functions hote hain jo dusre functions ko argument ke roop me lete
9. 'this' keyword current context (function, object) ko refer karta hai. Example: this.name will refer to
10. Callback functions wo functions hote hain jo dusre function ko argument ke roop me pass kiye
jate hain aur function ke complete hone par call kiye jate hain.
11. Promise kya hota hai aur kaise kaam karta hai?
11. Promise ek object hai jo asynchronous operation ko represent karta hai. Yeh 'pending',
12. Asynchronous programming me operations ek time pe chal rahe hote hain, aur synchronous me
ek ke baad ek.
13. JavaScript me array methods like map(), filter(), reduce() kaise kaam karte hain?
13. map() array ke har item pe function apply karta hai, filter() array se specific elements ko select
karta hai, aur reduce() array ko single value me reduce karta hai.
15. DOM manipulation se elements ko add, delete ya modify kiya jata hai. Example:
document.getElementById('myElement').innerHTML = 'Hello!';
16. JavaScript me classes ko 'class' keyword se define kiya jata hai, jaise: class Person {
17. ES6 features me arrow functions, template literals, destructuring, spread/rest operators,
18. Template literals kya hote hain aur kaise use karte hain?
18. Template literals strings ko dynamically generate karne ka easy tarika hain. Example: let
19. Destructuring se variables ko easily assign kiya ja sakta hai from arrays or objects. Example: let
20. Spread operator array ya object ko expand karta hai. Rest operator function parameters ko
21. Error handling me try-catch block ka use hota hai. Example: try { // code } catch (error) {
console.log(error); }
22. JavaScript modules se code ko separate files me organize kiya jata hai. import/export ka use
hota hai.
23. Event loop kya hota hai aur JavaScript me kaise kaam karta hai?
23. Event loop JavaScript ke asynchronous operations ko manage karta hai. Yeh stack ko check
karta hai aur tasks ko execute karta hai jab stack empty hota hai.
24. JavaScript me memory leak kya hota hai aur kaise avoid karte hain?
24. Memory leak tab hota hai jab unnecessary objects ya variables memory me rehte hain. Avoid
25. JavaScript me deep copy aur shallow copy me kya difference hai?
25. Deep copy me object ka ek naya copy banta hai, jabki shallow copy me references copy hote
hain.
26. localStorage me data browser ke session ke beyond persist rehta hai, jabki sessionStorage sirf
27. '==' sirf value compare karta hai, jabki '===' value aur type dono ko compare karta hai.
28. JavaScript me closures ka real-world example dikhaiye.
28. Closures ka real-world example ho sakta hai ek function jo private variables ko access kare,
29. Recursion me function apne aap ko call karta hai jab tak condition satisfied nahi hoti. Example:
30. call(), apply() aur bind() teeno functions 'this' ko manually set karne me help karte hain, lekin call
aur apply arguments ko directly pass karte hain, jabki bind ek naya function return karta hai.