Let's Learn Vocabularies

আপনি এখনো কোন Lesson Select করেন নি
একটি Lesson Select করুন।
Frequently Asked Questions
1. the difference between var, let, and const ?
🔥 Summary of Differences:
- 1. var → function-scoped, allows redeclaration and reassignment, hoisted as undefined.
- 2. let → block-scoped, no redeclaration, allows reassignment, safer than var.
- 3. const → block-scoped, no redeclaration, no reassignment (except modifying object properties).
2.the difference between map(), forEach(), and filter() ?
🔥 Key Differences in Simple Terms
- 1. map() transforms each element and returns a new array.
- 2. forEach() loops over elements but does not return anything.
- 3. filter() selects elements based on a condition and returns a new array.
3. explain arrow functions and how they are different from regular functions ?
🔥 Summary of Differences:
- 1. Syntax: Arrow functions are more concise.
- 2. this: In normal functions, this is dynamic, while in arrow functions, it is lexical (inherited from the parent scope).
- 3. arguments: Normal functions have the arguments object, while arrow functions use the rest parameter (...args).
- 4. Constructor: Normal functions can be used with new, but arrow functions cannot.
- 5. Hoisting: Normal functions are hoisted, while arrow functions are not.
4.how JavaScript Promises work ?
- Promise is a representation of the completion (or failure) of an asynchronous operation.
- It is resolved with a value or rejected with an error.
- .then() is used to handle the success result, and .catch() is used to handle errors.
- async and await make working with Promises simpler and more readable.
- Promise.all() waits for all Promises to be fulfilled, while Promise.race() returns as soon as any Promise is fulfilled or rejected.
5.how closures work in JavaScript ?
- A closure is a function that retains access to its lexical scope even after the outer function has returned.
- Closures enable features like data encapsulation and private variables, making JavaScript more powerful and flexible.
- Closures can be used for creating function factories, maintaining state, and handling asynchronous operations like event handlers.