JavaScript Basics Operators

JavaScript Basics Operators

1. Operators

Operators, also known as operators, are symbols used to implement functions such as assignment, comparison, and arithmetic operations.

Commonly used operators in JavaScript are:

  • Arithmetic operators (+, -, *, /, %)
  • Increment and decrement operators (++num, num++, --num, num--)
  • Comparison Operators
  • Logical operators
  • Assignment Operators

Assignment operation:

var a = 1; //Put the value on the right into the variable on the left

Comparison operations:

  • Comparison operation - refers to the comparison of the size of numbers: > < >= <=
  • The result of the comparison operation must be a Boolean value.

Logical operations:

  • Logical operators: && (and) || (or) ! Not/invert
  • && and || are used to connect two conditions to form a large conditional judgment result

Increment and decrement operations:

++ Increment symbol

When the ++ symbol encounters the output, the symbol is at the back, so ++ is performed last and the output is performed first

console.log( a++ );

When the ++ symbol encounters the output, the symbol comes first, so ++ is performed first, and then the output

console.log(++a);

The same applies to the minus sign

--Decrement symbol

Summarize

This article ends here. I hope it can be helpful to you. I also hope that you can pay more attention to more content on 123WORDPRESS.COM!

You may also be interested in:
  • This article summarizes the characteristics of logical operators in JS
  • Let's take a look at the same old JS operator explanation
  • Detailed explanation of JS operator precedence and expression examples
  • Simple usage examples of JS operators
  • JavaScript equality operator nine rules with examples
  • Detailed explanation of || and && operators in js
  • Detailed explanation of operator overloading in Javascript
  • Explanation of operators in JavaScript

<<:  HTML scroll bar textarea attribute setting

>>:  Use of MySQL triggers

Recommend

Front-end JavaScript operation principle

Table of contents 1. What is a JavaScript engine?...

How to update v-for in Vue

Tips: Array change method will cause v-for to upd...

Detailed tutorial on deploying Springboot or Nginx using Kubernetes

1 Introduction After "Maven deploys Springbo...

A brief summary of basic web page performance optimization rules

Some optimization rules for browser web pages Pag...

How to implement import and export mysql database commands under linux

1. Export the database using the mysqldump comman...

A brief analysis of the use of watchEffect in Vue3

Preface Everyone should be familiar with the watc...

Analysis and application of irregular picture waterfall flow principle

The layout problem of irregular picture walls enc...

Sliding menu implemented with CSS3

Result:Implementation code: <!DOCTYPE html>...

The concept of MTR in MySQL

MTR stands for Mini-Transaction. As the name sugg...

Bootstrap 3.0 study notes page layout

This time we will mainly learn about layout, whic...

Implementation of building Kubernetes cluster with VirtualBox+Ubuntu16

Table of contents About Kubernetes Basic environm...

js drag and drop table to realize content calculation

This article example shares the specific code of ...

js realizes packaging multiple pictures into zip

Table of contents 1. Import files 2. HTML page 3....

Sample code for separating the front-end and back-end using FastApi+Vue+LayUI

Table of contents Preface Project Design rear end...