DEV Community

Cover image for Most frequent JavaScript symbols and what they perform.
Baha Mustafa
Baha Mustafa

Posted on

Most frequent JavaScript symbols and what they perform.

JavaScript is a sophisticated and adaptable programming language that can be used to develop interactive websites, online applications, and mobile apps. To become proficient in JavaScript, it is necessary to comprehend the numerous symbols and keywords used in the language, as these are the building blocks of JavaScript programming.

Let's look at some of the most frequent JavaScript symbols and what they do.

Addition (+)

The addition symbol in JavaScript is used to add two values together or concatenate two strings. For example, 1 + 2 would return 3, while "Hello" + "world" would return "Helloworld".

Subtraction (-)

The subtraction symbol in JavaScript is used to subtract one value from another. For example, 3 - 1 would return 2.

Multiplication (*)

The multiplication symbol in JavaScript is used to multiply two values together. For example, 3 * 2 would return 6.

Division (/)

The division symbol in JavaScript is used to divide one value by another. For example, 6 / 2 would return 3.

Modulus (%)

The modulus symbol in JavaScript returns the remainder of a division operation. For example, 7 % 3 would return 1.

Equality (==)

The equality symbol in JavaScript is used to compare two values for equality (without type checking). For example, "3" == 3 would return true.

Strict Equality (===)

The strict equality symbol in JavaScript is used to compare two values for equality (with type checking). For example, "3" === 3 would return false.

Inequality (!=)

The inequality symbol in JavaScript is used to compare two values for inequality (without type checking). For example, "3" != 2 would return true.

Strict Inequality (!==)

The strict inequality symbol in JavaScript is used to compare two values for inequality (with type checking). For example, "3" !== 2 would return true.

Greater Than (>)

The greater than symbol in JavaScript is used to check if one value is greater than another. For example, 3 > 2 would return true.

Greater Than or Equal To (>=)

The greater than or equal to symbol in JavaScript is used to check if one value is greater than or equal to another. For example, 3 >= 3 would return true.

Less Than (<)

The less than symbol in JavaScript is used to check if one value is less than another. For example, 2 < 3 would return true.

Less Than or Equal To (<=)

The less than or equal to symbol in JavaScript is used to check if one value is less than or equal to another. For example, 3 <= 3 would return true.

Logical AND (&&)

The logical AND symbol in JavaScript returns true if both expressions are true. For example, true && true would return true.

Logical OR (||)

The logical OR symbol in JavaScript returns true if at least one expression is true. For example, true || false would return true.

Logical NOT (!)

The logical NOT symbol in JavaScript inverts the truth value of an expression. For example, !true would return false.

Dot notation (.)

The dot notation symbol in JavaScript is used to access a property or method of an object. For example, object.property would return the value of the property.

"typeof" (Type Operator) - Used to return the data type of a value.

"instanceof" (Instance Operator) - Used to check if an object is an instance of a particular class or constructor function.

"new" (New Operator) - Used to create a new instance of an object or constructor function.

"this" (This Keyword) - Refers to the current object or context.

"try...catch" (Try Catch Statement) - Used to handle errors and exceptions in code.

"switch" (Switch Statement) - Used to perform different actions based on different cases.

"NaN" (Not a Number) - A value representing an undefined or unrepresentable mathematical value.

"undefined" (Undefined) - A value representing an undefined or non-existent value.

"null" (Null) - A value representing a null or empty value.

"$" (Dollar Sign) - Used in many JavaScript libraries as a shorthand to access and manipulate HTML elements.

"async" (Async Function) - Used to define an asynchronous function that returns a promise.

"await" (Await Operator) - Used to pause the execution of an asynchronous function until a promise is resolved or rejected.

Finally, the dot notation symbol (.) is used to access a property or method of an object. For example, object.property would return the value of the property.

Top comments (0)