Reserved words ไม่สามารถใช้เป็นตัวแปร ฟังก์ชัน เมธอด loop labels หรือชื่อออบเจกต์ใน JavaScript ได้
รายการ reserved words ใน JavaScript:
| abstract | else | instanceof | switch |
|---|---|---|---|
| boolean | enum | int | synchronized |
| break | export | interface | this |
| byte | extends | long | throw |
| case | false | native | throws |
| catch | final | new | transient |
| char | finally | null | true |
| class | float | package | try |
| const | for | private | typeof |
| continue | function | protected | var |
| debugger | goto | public | void |
| default | if | return | volatile |
| delete | implements | short | while |
| do | import | static | with |
| double | in | super |
หมายเหตุ
- บางคำเป็น future reserved words (เช่น
enum,awaitใน module) — สำรองไว้สำหรับมาตรฐานอนาคต - คำบางคำใช้งานอยู่แล้ว (keywords) เช่น
if,for,function - ห้ามใช้เป็นชื่อตัวแปร ฟังก์ชัน property name (ยกเว้นใน object literal property shorthand บางกรณี)