English is Easy!!
আজ থেকেই আপনার ভাষা শেখার যাত্রা শুরু করুন। আপনি যদি নতুন হন অথবা আপনার দক্ষতা বাড়াতে চান, আমাদের Interactive Lessons আপনাকে নিয়ে যাবে অন্য একটি Level এ

Let's Learn Vocabularies
Frequently Asked Questions
1. What is the difference between var, let, and const?
`var` is function-scoped and allows to be reassigned. It is a hoisted variable and can be used prior to its declaration, showing an `undefined` value. On the other hand, `let` is block-scoped as well, so it is also allow to be reassigned, but hoisting it doesn't initialize it and this is a cause of `ReferenceError` during an early access. `const` is also a block-scoped variable, like `let`, but it does not allow to be reassigned and besides, like `let`, it is not initialized when hoisted so that in case of accessing it before the declaration there will be a `ReferenceError`.Overall, `var` is best for function scope, while `let` and `const` are better for block scope, with `const` giving immutability.
2. What is the difference between map(), forEach(), and filter()?
In JavaScript, the `map()`, `forEach()`, and `filter()` methods are processed by using arrays. The `map()` method generates a new array by utilizing a function to all the elements of the original array. Unlike `map()`, `forEach()` works by running the given function once for each item of the array and does not give back a new array. The `filter()` method is used to create a new array containing the elements that meet the test function criterion. In brief, `map()` and `filter()` are functions that create new arrays, `map()` is used for changing elements and `filter()` is used for choosing elements, while `forEach()` does an operation on each element without returning a new array.
3. What are arrow functions and how are they different from
regular functions?
Arrow functions, which are a feature of ES6, have the syntax for functions in JavaScript that is most concise. In contrast to general functions, an arrow function has no `this` context of its own; it inherits `this` from the outer scope. For this reason, they are very practical for the purpose of holding the context in callbacks and event handlers. Unlike using constructors, arrow functions are not able to do this and there is no `arguments` object associated with them. From the perspective of syntax, they are shorter and tend to be more expressive. For example, `const add = (a, b) => a + b;` is an arrow function definition; whereas a classical function would be `function add(a, b) { return a + b; }`.
4. How do JavaScript Promises work?
Promises in JavaScript are the ones that indicate either the asynchronous operation has been accomplished or failed and what is that operation's result. Firstly, a Promise can either be in a state of pending, fulfilled, or rejected. The moment a promise is generated, it is in the pending state. When the matter in doubt regarding the asynchronous operation is solved and the proposition is either confirmed (by a specific value) or withdrawn (by a certain reason), the promise thus achieves the state. Promises use `.then()` for fulfillment managing, `.catch()` for rejections handling, and `.finally()` for code that runs right no matter if the outcome is good or bad. This is necessary not for just but also for effective coding because it makes the handling of asynchronous operations both clearer than traditional callback methods and more manageable.
5. How does closure work in JavaScript?
JavaScript defines a closure as a function that is in a functional scope relative to another function and has access to the outer function's variables after the outer function has executed. This is due to the inner function that keeps a reference to the variables in its lexical scope. Closures allow data to be encapsulated and create private variables that are necessary to keep the state and prevent global variable conflicts. For instance, the functions created in looping can individually remember their own scope thus reflecting the effectiveness and versatility of closures in controlling scope and state in JavaScript.