Skip to content · ⁨ข้ามไปยังเนื้อหา⁩
English

Arrow functions

  • A shorter way to write a function: const square = (n) => n * n;.
  • With a single expression after =>, the value is returned automatically — no return, no { }.

ไทย

ฟังก์ชันลูกศร (Arrow functions)

  • วิธีเขียนฟังก์ชันที่สั้นกว่า: const square = (n) => n * n;
  • เมื่อมีนิพจน์เดียวหลัง => ค่าจะถูก ส่งกลับอัตโนมัติ — ไม่ต้องใช้ return และไม่ต้องใช้ { }

ฟังก์ชันเดียวกันเขียนสองแบบ: แบบยาว และแบบลูกศรสั้น

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP