Celebrating 10 years in web hosting [email protected]

What are JavaScript Operators?

In this article, we see the JavaScript operators like Relational Operators in JavaScript, Boolean Operators in JavaScript, JavaScript OR Operator, JavaScript AND Operator, and JavaScript NOT Operator.

The JavaScript operators are unique symbols used to carry out actions on operands for using values and variables. 

IF you want then buy a good, reliable, secure web hosting service  from here: click here

Like, 2 + 4; // 6, Here the operator + performs addition, and the operands are 2 and 4.

So, in this article, we will try to discuss relational operators and Boolean operators in JavaScript.

Relational Operators in JavaScript 

For JavaScript, the Relational operators are operators that check whether a relationship between two values exists and deliver true or false depending on the result.

The JavaScript relational operators are:

  • greater-than >
  • less-than <
  • greater-than-or-equal-to >=
  • less-than-or-equal-to <=

In this comparison, operators accept any kind of operand as an argument. Operands that are not integers or strings must be transformed because comparisons can only be made on those types of operands.

You can purchase your hosting from Cloudsurph.comCloudsurph hosting is a reliable hosting option for business and personal projects. We offer insight and help on system configuration issues and code errors or bugs.

Boolean Operators in JavaScript 

Firstly, the Boolean operators, “and”, “or”, and “not” are the three available operators.

Secondly, they are particularly helpful to developers when creating parts of a complex logic or flow and may be utilized in either a database or coding.

JavaScript Boolean operators are:

  1. JavasScript OR Operator
  2. JavaScript AND Operator
  3. JavaScript NOT Operator

JavaScript OR Operator

The OR operator is symbolically represented by two vertical lines for JavaScript. We can see the below example:

Syntax:
result = a || b; // same as a OR b

Hence, the Boolean operator is only used to assess several Boolean variables in a typical computer language.

Also, the expression evaluates and returns true if any of the supplied variables are true; otherwise, it would produce a false value.

JavaScript AND Operator

JavaScript has the two ampersands && serves as the symbolic representation of the AND operator.

Syntax: 
var result = a && b; // equivalent to a AND b

The Boolean AND operator are used to test various Boolean operands, like the OR operator.

Therefore, the expression tests and returns false if any of the supplied variables are false; otherwise, it would return a true value.

Basically, using the AND operator, the following four logical Boolean value combinations are listed below:

  • False || True i.e False“OR” True // the output will be False
  • True || True i.e. True “OR” True // the output will be True
  • False || False i.e False“OR” False // the output will be False
  • True || False i.e True “OR” False // the output will be False

JavaScript NOT Operator

The exclamation mark is used as the symbolic representation of the NOT operator in JavaScript.

Syntax:
var result = ! y;

The Boolean AND operator, like the OR and AND operators and is exclusively used to test various Boolean operands.

Since it will return the inverse of the operand that was supplied to it and it is used to invert the operand’s value.

That’s it. If you enjoyed reading this article and have more questions please reach out to our support team via live chat or email and we would be glad to help you. we provide server hosting for all types of need and we can even get your server up and running with the service of your choice.