আজ থেকেই আপনার ভাষা শেখার যাত্রা শুরু করুন। আপনি যদি নতুন হন অথবা আপনার দক্ষতা বাড়াতে চান, আমাদের Interactive Lessons আপনাকে নিয়ে যাবে অন্য একটি Level এ
আপনি এখনো কোন Lesson Select করেন নি
1. what is the difference between var, let, and const?
var
let
const
- var: Function-scoped, can be redeclared & reassigned, hoisted with `undefined`. - let: Block-scoped, cannot be redeclared, hoisted but not initialized. - const: Block-scoped, cannot be reassigned, must be initialized at declaration.
2. What is the difference between map(), forEach(), and filter()?
map()
forEach()
filter()
- map(): Returns a new array with modified values. - forEach(): Loops through elements but does not return a new array. - filter(): Returns a new array with elements that satisfy a condition.
3. Explain arrow functions and how they are different from regular functions?
Arrow functions (`=>`) provide a shorter syntax and do not bind `this`. Differences: - No own `this` (inherits from parent scope). - Cannot be used as constructors. - No `arguments` object (use rest parameters instead).
4. How do JavaScript Promises work?
A Promise represents a future value that can be `fulfilled`, `rejected`, or `pending`. - Use `.then()` for success handling. - Use `.catch()` for error handling. - Use `async/await` for cleaner asynchronous code.
5. How do closures work in JavaScript?
A closure allows a function to remember variables from its parent scope, even after the parent function has executed. Example:
function outer() { let count = 0; return function inner() { count++; console.log(count); }; } const counter = outer(); counter(); // 1 counter(); // 2