Reserved words in Javascript
Back at it with another technical blog for ya’ll ! In my software developing journey I’ve learned so many things and I find comfort in knowing that even the most seasoned developer cannot know everything. One of the many things I will probably never fully remember is reserved words in Javascript. Declaring variables is mandatory and necessary in programming, for a little while variables were kind of confusing because I’d hear my instructor say you can call variables anything. One of the famous variables we used in bootcamp was chicken, once I realized that we can name variables anything, I took it and ran with it. Very quickly I realize technically we can’t name variables just anything, there’s certain words that are reserved identifiers and cannot be used to name a variable, function or label.
There’s over 50 reserved words in Javascript, I won’t bore you or myself with this list but let’s go over a few of them.
Abstract, is a non-access modifier which is applicable for classes and methods but not variables.
Arguments, is an array-like object lists the arguments and a few other properties.
Await, this keyword makes Javascript wait until a promise returns a result.
Boolean, is used to get the value of a variable, object, conditions, etc in terms of true or false.
Break, breaks the loop and continues executing the code after the loop.
Byte, this uses the Javascript typeof()
operator to detect what kind of type is variable x and y.
Case, a switch statement that evaluates an expression. The value of the expression is then compared with the values of each case in the structure.
Catch, this keyword allows you to define a block of code to be executed if an error occurs in the try
block.
Char, this keyword is data type that is used to store a single character.
Class, another way of writing constructor functions which can be used in order to create a new object using the new keyword.
Default, this keyword can be within a switch statement or with an export statement.
Delete, this keyword is used to delete the value of the property and the property itself.
Double, Javascript numbers are always stored as double precision floating point numbers.
Else, this keyword is part of Javascripts conditional statements, used to perform different actions based on the different conditions.
Enum, declares an enumerated type.
Eval, eval()
evaluates or executes an argument.
Float, Javascript numbers are always stored as double-precision floating-point numbers.
Goto, the goto is accomplished in JS using the break and continue keyword.
Implements, this keyword is used to implement an interface.
Long, this keyword long represents a 64 bit two’s-complement integer value.
Native, is a applied to a method to indicate that the method is implemented in native code.
New, this keyword constructs and returns an object of a constructor function.
These are just a fraction of the many reserved keywords in Javascript. There also other reserved words in reference to HTML and Window objects that you should avoid such as alert, anchor, assign, blur, button, checkbox
and many, many more. If you’d like a full list of the reserve words check out W3Schools and Edureka. Thanks for taking time out to read this blog!! Clap for me!