1. Keyword/ Reserved word
Keywords are reserved words that are part of the syntax in the programming language. For example,
var a = 8;
Here, var is a keyword that denotes that a is a variable.
Some examples are for, function, this, typeof, void, true, etc.
An identifier is a name that is given to entities like variables, functions, class, object etc.
var a = 8;
Here, we are using 'a' as an identifier to name the variable.
Difference between var, let, and const
For more detailed explanation please read this article
Operators are reserved words that perform the action on values and variables. Operators are used to perform specific mathematical and logical computations on operands.
For example, in 7 + "5", the + sign is an operator and 7 (number) is left side operand and "8" (string) is right-side operand. The + operator performs the addition of two values/expressions and returns a result.
- Arithmetic Operators
- Comparison Operators
- Logical Operators
- Assignment Operators
- Ternary Operators
- typeof Operator
- String operators
- Comma operator
- Relational operators
- Unary operators
Follow MDN for complete details about each Operator.
A reference, value, or a group of reference(s) and values(s) combined with operator(s), which result in a single value. In simple words, expression is a combination of values, variables, operators which computes a value.
Every syntactically valid expression resolves to some value but conceptually, there are two types of expressions: with side effects (for example those that assign value to a variable) and those that in some sense evaluate and therefore resolve to a value.
The expression x = 7 is an example of the first type. This expression uses the = operator to assign the value seven to the variable x. The expression itself evaluates to seven.
The code 3 + 4 is an example of the second expression type. This expression uses the + operator to add three and four together without assigning the result, seven, to a variable.
var a = 7 + "5";
This article discussed briefly some important JS vocabularies, I hope you find this article helpful. I'll be posting more articles like this on my account, so please stay connected. If you have any questions, feel free to reach out!
Thank you for reading!
Top comments (0)