Home  >  Article  >  Web Front-end  >  What types of operators are divided into in js? What are the differences?

What types of operators are divided into in js? What are the differences?

青灯夜游
青灯夜游forward
2018-10-23 16:51:521865browse

The content of this article is to introduce what types of operators are divided into in JavaScript? What are the differences? It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

There are arithmetic operators, assignment operators, comparison operators, logical operators, bit operators, unary operators and other operators in JavaScript

Arithmetic operators:

What types of operators are divided into in js? What are the differences?

Assignment operator:

Comparison operator:

Logical operators:

Bit operators:

In addition, there is also the typeof operator, which can return variables Or the type of expression:

console.log(typeof 1);            //num
console.log(typeof 'Mark');             //string
console.log(typeof true);               //boolean
console.log(typeof [1,2,3]);            //object
console.log(typeof {name:'Mark'});      //object

javaScript also supports the delete operator, which can delete attributes in the object:

var myObj = {name:'Mark',age:18};
delete myObj.age;
console.log(myObj);  //{name:'Mark'}

The above is the detailed content of What types of operators are divided into in js? What are the differences?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete