0% found this document useful (0 votes)
95 views2 pages

JavaScript Data Types and Key Concepts

The document outlines key JavaScript concepts including data types, variable declarations (var, let, const), hoisting, and the differences between null and undefined. It also explains asynchronous programming with promises and async/await, as well as various function types and their behaviors. Additionally, it covers event handling, storage options, and higher-order functions.

Uploaded by

nayaknarayan930
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views2 pages

JavaScript Data Types and Key Concepts

The document outlines key JavaScript concepts including data types, variable declarations (var, let, const), hoisting, and the differences between null and undefined. It also explains asynchronous programming with promises and async/await, as well as various function types and their behaviors. Additionally, it covers event handling, storage options, and higher-order functions.

Uploaded by

nayaknarayan930
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. What are the different data types in JavaScript?

Primitive: string, number, boolean, null, undefined, symbol, bigint. Non-primitive: object, array,
function.

2. Difference between var, let, and const?


var: function-scoped, hoisted, can re-declare. let: block-scoped, cannot re-declare in same scope.
const: block-scoped, cannot reassign.

3. What is hoisting?
Moving variable and function declarations to the top before execution.

4. Difference between == and ===?


== compares only value (type coercion). === compares value + type.

5. What are closures?


Function that remembers outer scope variables even after outer function ends.

6. Difference between null and undefined?


undefined: variable declared but not assigned. null: intentional empty value.

7. What is event bubbling and capturing?


Bubbling: child → parent. Capturing: parent → child.

8. What are promises?


Promises handle async ops with states: pending, fulfilled, rejected.

9. What is async/await?
Syntactic sugar for promises, makes async look synchronous.

10. Function declaration vs function expression?


Declaration: hoisted. Expression: not hoisted.

11. Difference between for...in and for...of?


for...in: iterates keys. for...of: iterates values.

12. What are arrow functions?


Short syntax, no own 'this'.

13. Synchronous vs Asynchronous JS?


Sync: executes line by line (blocking). Async: non-blocking (e.g., fetch).

14. Deep copy vs Shallow copy?


Shallow copy: only first level. Deep copy: complete independent copy.

15. Difference between map, filter, forEach?


map: returns new array. filter: new array of matches. forEach: loops only.
16. Synchronous vs Asynchronous callbacks?
Sync: runs immediately. Async: runs later (setTimeout).

17. localStorage vs sessionStorage vs cookies?


localStorage: no expiry. sessionStorage: clears on tab close. cookies: small, sent with requests.

18. Higher-order functions?


Functions taking/returning other functions (map, filter, reduce).

19. What is 'this'?


Depends on context: object method → object, global → window, arrow → parent scope.

20. Difference between call, apply, bind?


call: args individually. apply: args as array. bind: returns new function with bound this.

You might also like