Tech TutorBangla Web Documentation
Portfolio
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • JavaScript Documentation48টি অধ্যায়
প্রযুক্তি নির্বাচন
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • Introduction
  • JavaScript কী?
  • Syntax & Comments
  • Variables
  • Data Types: Basics
  • Data Types: Conversion
  • Data Types: Advanced
  • Strings
  • Numbers & Math
  • Date & Time
  • Operators
  • Conditions
  • Loops
  • Functions: Basics
  • Functions: Intermediate
  • Functions: Advanced
  • Scope & Hoisting
  • Closures & this
  • ES6+ Modern
  • Arrays: Basics
  • Arrays: Intermediate
  • Arrays: Advanced
  • Objects: Basics
  • Objects: Intermediate
  • Objects: Advanced
  • Class: Basics
  • Class: Intermediate
  • Class: Advanced
  • DOM: Basics
  • DOM: Intermediate
  • DOM: Advanced
  • Events: Basics
  • Events: Intermediate
  • Events: Advanced
  • Async JavaScript
  • Promise
  • Async / Await
  • Fetch API
  • JSON
  • Modules
  • Browser Storage
  • Event Loop Deep
  • Prototype Chain
  • Iterators & Generators
  • WeakMap, WeakSet, Proxy
  • Error Handling
  • Practice Problems
  • Mini Projects
  • Basics
  • Functions & Scope
  • Types & Syntax
  • Arrays & Objects
  • Advanced
  • Functional Programming
  • Objects & Symbols
  • Async Deep Dive
  • Modern JavaScript
  1. Docs
  2. JavaScript
  3. প্রশ্ন/উত্তর
  4. Functions & Scope
  5. Q7. What are arrow functions and how do they differ from regular functions?
JavaScriptFunctions & Scope

Q7. What are arrow functions and how do they differ from regular functions?

Arrow function-এর সুবিধা ও সীমাবদ্ধতা, regular function থেকে পার্থক্য — উদাহরণসহ।

Arrow function হলো ES6-এ আসা সংক্ষিপ্ত ফাংশন লেখার নতুন উপায় — ফাংশন keyword লেখার বদলে => তীর চিহ্ন বসে। এটি মূলত একটি অ্যানোনিমাস ফাংশনের শর্টহ্যান্ড, তাই ছোট কাজে দারুণ সুবিধাজনক।

তিন প্রকার লেখার ধরনjavascript
javascript
// regular function
function add(a, b) {
  return a + b;
}

// arrow function — একই কাজ, ছোট লেখায়
const add2 = (a, b) => {
  return a + b;
};

// আরও ছোট — এক লাইনে return ছাড়াই
const add3 = (a, b) => a + b;

// একটি প্যারামিটার হলে বন্ধনীও লাগে না
const square = (n) => n * n;
const square2 = (n) => n * n;

console.log(add(2, 3), add2(2, 3), add3(2, 3)); // 5 5 5
console.log(square(4), square2(4));             // 16 16

সবচেয়ে বড় পার্থক্য হলো `this`-এর আচরণ। Arrow function-এর নিজস্ব this নেই — সে বাইরের scope থেকে this ধার করে নেয়।

this-এর পার্থক্যjavascript
javascript
const user = {
  name: "Rahim",

  regular: function () {
    return this.name; // Rahim — নিজস্ব this
  },

  arrow: () => this.name, // undefined — this ধার করেছে
};

console.log(user.regular()); // Rahim
বিষয়Regular functionArrow function
thisনিজের thisবাইরের this ধার করে
argumentsনিজস্বথাকে না
নিজের prototypeথাকেথাকে না
new দিয়ে তৈরিযায়যায় না
hoisting হয়হ্যাঁনা
সরাসরি return ছাড়ালাগেএক লাইনে লেখা যায়
সতর্কতা

অবজেক্টের method হিসেবে arrow function ব্যবহার করলে this কাজ করবে না, কারণ সেটি ট্রিকি ধরে ফেলবে না। অবজেক্টের method লাখার জন্য regular function বা class method ব্যবহার করুন।

শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।
Functions & Scope বিভাগের আরও প্রশ্নJavaScript প্রশ্ন/উত্তর
Tech Tutor

বাংলায় ওয়েব ডেভেলপমেন্ট ডকুমেন্টেশন শিখুন — ধাপে ধাপে।

Homeসব ডকুমেন্টেশনQuick Startআমার নোটস

© 2026 Tech Tutor. বাংলায় শিখুন, বাংলায় গড়ুন।

mdanamolhasan1998@gmail.com