Category: Important Keywords
-
var Keyword
The var keyword in JavaScript is used to declare variables. Before ES6, there was only var keyword to declare a variable. In ES6, let and const keywords were introduced as a better way to declare variables. It is advised to use let instead of var to declare a variable. If you are targeting older version of browser, you can…
-
new Keyword
The new keyword in JavaScript is used to create an instance of the object that has constructor function. Using new keyword, we can create the instances of a user-defined as well as built-in object types. We can create instances of the classes, prototype, or constructor functions. When a JavaScript function is called with new keyword, the function…
-
void Keyword
The void keyword in JavaScript is used as an operator that evaluates a given expression and returns undefined. The void is an important keyword in JavaScript. The meaning of the void is null or empty. The void keyword can be used as a unary operator that appears before its single operand, which may be of any type. This operator specifies an expression to be evaluated without returning…
-
this Keyword
What is ‘this’ keyword? In JavaScript, the ‘this‘ keyword contains the reference to the object. It represents the context of the function or current code. It is used to access the properties and methods of the current object. When this keyword is used inside a function, the this will refer to the object that the…