Rajdeep Singh
Published in

Rajdeep Singh

Reserved Keyword In Javascript?

Javascript has a Predefined Collection of reserved keywords that can not be used as variables Name, Labels or Function, and Class Name.

Reserved Keyword In Javascript?

ECMA Script: 1 😊

  1. break
  2. catch
  3. case
  4. class
  5. const
  6. continue
  7. debugger
  8. default
  9. delete
  10. do
  11. else
  12. enum
  13. export
  14. extends
  15. false
  16. finally
  17. for
  18. function
  19. if
  20. import
  21. in
  22. new
  23. null
  24. return
  25. super
  26. switch
  27. this
  28. throw
  29. true
  30. try
  31. typeof
  32. var
  33. void
  34. while
  35. with

ECMA Script: 2 😍

Add 24 additional reserved keywords in javascript.

new keywords denote by *

  1. abstract*
  2. boolean*
  3. break*
  4. byte*
  5. case*
  6. catch*
  7. char*
  8. class
  9. const*
  10. continue*
  11. debugger
  12. default*
  13. delete*
  14. do*
  15. double
  16. else*
  17. enum
  18. export
  19. extends
  20. false*
  21. final*
  22. finally*
  23. float*
  24. for*
  25. function*
  26. goto*
  27. if
  28. implements
  29. import
  30. in
  31. instanceof*
  32. int*
  33. interface*
  34. long*
  35. native*
  36. new
  37. null
  38. package*
  39. private*
  40. protected*
  41. public*
  42. return
  43. short*
  44. static*
  45. super
  46. switch
  47. synchronized*
  48. this
  49. throw
  50. throws*
  51. transient*
  52. true
  53. try
  54. typeof
  55. var
  56. void
  57. volatile*
  58. while
  59. with

ECMA Script: 5 😍

No change since ECMAScript 3

ECMAScript 5 remove int, char, goto, long, final, float, short, double, native, throws, boolean, abstract, volatile, transient, and synchronized.

Add 2 additional reserved keywords in javascript.

  1. break
  2. catch
  3. case
  4. class
  5. const
  6. continue
  7. debugger
  8. default
  9. delete
  10. do
  11. else
  12. enum
  13. export
  14. extends
  15. false
  16. finally
  17. for
  18. function
  19. if
  20. implements
  21. import
  22. in
  23. instanceof
  24. interface
  25. let*
  26. new
  27. null
  28. package
  29. private
  30. protected
  31. public
  32. return
  33. static
  34. super
  35. switch
  36. this
  37. throw
  38. true
  39. try
  40. typeof
  41. var
  42. void
  43. while
  44. with
  45. yield*

ECMA Script: 6

  1. await
  2. break
  3. case
  4. catch
  5. class
  6. const
  7. continue
  8. debugger
  9. default
  10. delete
  11. do
  12. else
  13. export
  14. extends
  15. finally
  16. for
  17. function
  18. if
  19. import
  20. in
  21. instanceof
  22. new
  23. return
  24. super
  25. switch
  26. this
  27. throw
  28. try
  29. typeof
  30. var
  31. void
  32. while
  33. with
  34. yield

Note:

The following keywords are not reserved, but when you use strict mode on javascript, that time shows an error.

  1. implements
  2. interface
  3. let
  4. package
  5. private
  6. protected
  7. public
  8. static

Other:

  1. true
  2. false
  3. null
  4. undefined

Reference:

Wrong ✖️

"use strict"function true(){}  //Show Error In Strict Modelet await = 'rajdeep singh';  //  Show Error with and without Strict Modelet case = 122  // Show Error with and without Strict Mojavade
Javascript SyntaxError
Javascript SyntaxError

Conclusion:

Javascript reserved keywords can not be used as a variable Name, Label or Function, and Class Name when using a named variable that shows SyntaxError.

If Any queries, mistakes, and Suggestions. Plz, tell me in the comment box.

--

--

--

Computer Science & Biology & Bioinformatic

Recommended from Medium

Sorting data from a GraphQL+GraphCool Endpoint

Use Fetch API in JavaScript

Export content to pdf using javascript and html2PDF

Interesting Facts About Locksmiths https://t.co/zWqc5Rytg6

The dev.to project with GatsbyJS-30

Migrating to Typescript: Write a declaration file for a third-party NPM module

First CLI App using Node JS for Beginner’s

10 javascript things think you should know to learn programmin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rajdeep singh

Rajdeep singh

JavaScript || Reactjs || Nextjs || Python || Rust || Biotechnology || Bioinformatic || Front-end Developer || Writer || https://officialrajdeepsingh.dev/

More from Medium

Lesser-known JavaScript features — Part 2

Common Array Operations in JavaScript

Mastering Asynchronous JavaScript

JavaScript — Promise.all