JavaScript Operators And Types

Operators and Types of Operators

Operators :

Operators in a programming language are symbols used to perform operations on the values.

The values are termed as operands.

JS Operator

Operators are categorized as unary, binary and ternary operators based on the number of operands on which they operate in an expression.

Statement formed using operator and operands are called expression. In the above example, 5+10 is an expression.

JavaScript supports the following types of operators:

JS Type of operator

string :

Arithmetic operator + when used to concatenate two strings results into concatenation.

javascript string

Arithmetic operator + when used with a string value and a numeric value, it results in a new string value.

javascript string addition

Arithmetic :

Arithmetic operators are used to performing arithmetic operations.

JS Arithmetic operator
JS Arithmetic example

Assignment :

Assignment operators are used to assigning values to the variables.

JS Assignment operator
JS arithmatic operator

Relational or Comparison :

Relational operators are used to comparing values and the result of the comparison is always either true or false.

Relational operators shown below does implicit data type conversion of one of the operands before comparison.

JS Relational or Comparison
JS Relational operator

Relational operators shown below compares both the values and the value types without any implicit type conversion.

JS Strict equality and inequality

Strict equality (===) and Strict inequality (!==) operators consider only values of the same type to be equal.

Hence Strict equality and Strict inequality operators are highly recommended to determine whether 2 given values are equal or not.

We will be using these operators in our further exercises.

Logical :

Logical operators are used for combining one or more expressions and make decisions.

JS logical operator
JS Logical example

typeof :

typeof is an operator in JavaScript.

JavaScript is a loosely-typed language. The type of data assigned to a variable is decided at runtime. This is also called dynamic data binding.

As programmers, if required we can use this operator typeof to find the data type of a JavaScript variable.

Following are the ways it can be used and the corresponding results that it returns.

javascript typeof operator
#Operators_in_javascript #javascript_operator #ternary_operator_javascript #javascript_logical_operators #javascript_conditional_operator #javascript_and_operator #javascript_bitwise_operators #javascript_comparison_operators #javascript_assignment_operator

(New page will open, for Comment)

Not yet commented...