reading-notes

View project on GitHub

Welcome

JavaScript & jQuery

operators

Operators in JavaScript Programming

JavaScript operators are symbols which are used to assign values, compare values, perform arithmetic operations, and more.

  • The variables (operations) are called operands.
  • The operation (to be performed between the two operands) is defined by an operator.

    JavaScript supports the following types of operators.

  • Arithmetic Operators
  • Comparison Operators
  • Logical (or Relational) Operators
  • Assignment Operators
  • Conditional (or ternary) Operators
  • String Operators
  • Type Operators
  • Bitwise Operators

JavaScript Comparison Operators

Comparison and Logical operators are used to test for true or false.

comparison Operators

Example:-

  • if (age < 18) text = “Too young”; var voteable = (age < 18) ? “Too young”:”Old enough”; // ternary operator

    ’ if -else example age = Number(age); if (isNaN(age)) { voteable = “Input is not a number”; } else { voteable = (age < 18) ? “Too young” : “Old enough”; } ‘

JavaScript Logical (or Relational) Operators

Comparison and Logical operators are used to test for true or false. Logical operators are used to determine the logic between variables or values. Logical operations

  • To learn more visit Link

    Or

    • Watch it on YouTube Link

    Copyright © 2021 Simple Snippets. All rights reserved.