当前位置:网站首页>Brief introduction to JS operator
Brief introduction to JS operator
2022-07-28 12:53:00 【Xiao Yang should work hard】
Preface : I'm a freshman, Xiaobai , If there are any mistakes, please point out
Catalog
2. Increment and decrement operators
1. Arithmetic operator
1. Add (+) Normal operator
var x = 9;
var y = 8;
var z = x + y;
// The final result is 172. reduce (-) Normal operator
var x = 9;
var y = 8;
var z = x - y;
// The final result is 13. ride (*) Normal operator
var x = 9;
var y = 8;
var z = x * y;
// The final result is 724. except (/) Normal operator
var x = 6;
var y = 2;
var z = x / y;
// The final result is 35. Remainder (%) Operator
var x = 7;
var y = 2;
var z = x % y;
// The final result is the remainder 12. Increment and decrement operators
1. Pre increment : ++num Pre increment , It's self imposed 1, Be similar to num = num + 1, Abbreviation ++num, Add it first , Then return the value
2. Post increment : num++ It's self imposed 1, Be similar to num = num + 1, Abbreviation num++, Return the original value first , Post autoplus
3. Logical operators
1. Logic and &&
On both sides true To return to true, Otherwise return to false
console.log(true && false) //false;
console.log(3>2 && 1>2); //false
alert( 1 && 2 && null && 3 ); // null
2. Logic or ||
As long as one side is true Both return true, On both sides false When to return to false
console.log(true || false) //true;
console.log(3>2 || 1>2); //true
If one side is true, it is true , The output ture, False output on both sides false
3. Logic is not !
Logic is not (!) It's also called the negation , Used to take a value that is the opposite of a Boolean value , Such as true The opposite of this is false
var isOk = !true;
console.log(isOk); // false
4. Comparison operator
< Less than no. 1<2 true
> More than no. 1>2 false
>= Greater than or equal to 2>=2 true
<= Less than or equal to 3<=2 false
== Whether it is equal or not 2==2 true
!= Unequal sign 3!=2 true
!! The congruent operator
===Operands are not typed , Returns only if the values are equal and the types are equaltrue.
1. Equality operator
console.log(1 == 1); // true
console.log(1 == 2); // false
console.log(1 == true); // true
console.log(1 == '1'); // true2. Inequality operator
var a = 1;
var b = 2;
var c = '1';
console.log(a != 1); // false
console.log(a != b); // true
console.log(a != c); // false3. Greater than operator
console.log(5 > 1); // true
console.log(5 > 10); // false
console.log(5 > '5'); // false4. Greater than or equal to operator
console.log(5 >= 1); // true
console.log(5 >= 5); // true
console.log(5 >= 10); // false
console.log(5 >= '5'); // true5. Less than operator
console.log(5 < 1); // false
console.log(5 < 5); // false
console.log(5 < 10); // true
console.log(5 < '5'); // false6. Less than or equal to operator
console.log(5 <= 1); // false
console.log(5 <= 5); // true
console.log(5 <= 10); // true
console.log(5 <= '5'); // true7. Inequality operator
var a = 1;
var b = 2;
var c = '1';
console.log(a !== 1); // false
console.log(a !== b); // true
console.log(a !== c); // true5. Assignment operator

边栏推荐
- Flexpro software: measurement data analysis in production, research and development
- 20220728-Object类常用方法
- Baidu map API adds information window circularly. The window only opens at the last window position and the window information content is the same solution
- LeetCode394 字符串解码
- Quick read in
- HC-05蓝牙模块调试从模式和主模式经历
- 力扣315计算右侧小于当前元素的个数
- 揭秘界面控件DevExpress WinForms为何弃用受关注的MaskBox属性
- GMT installation and use
- Markdown concise grammar manual
猜你喜欢

leetcode 1518. 换酒问题

LeetCode94. 二叉树的中序遍历

Markdown concise grammar manual

FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be depreca

Interface control telerik UI for WPF - how to use radspreadsheet to record or comment

归并排序

Redis implements distributed locks

VS1003调试例程

Uncover why devaxpress WinForms, an interface control, discards the popular maskbox property

Connected Block & food chain - (summary of parallel search set)
随机推荐
Scala transformation, filtering, grouping, sorting
Machine learning practice - neural network-21
AVL tree (balanced search tree)
leetcode:704二分查找
The largest rectangle in leetcode84 histogram
Distributed session solution
Redefinition problem of defining int i variable in C for loop
Introduction to resttemplate
20220728 common methods of object class
The usage and Simulation Implementation of vector in STL
C语言项目中使用json
sqli-labs(less-8)
Marketing play is changeable, and understanding the rules is the key!
Fastjson parses multi-level JSON strings
非标自动化设备企业如何借助ERP系统,做好产品质量管理?
Uniapp 应用开机自启插件 Ba-Autoboot
mysql limit 分页优化
Which big model is better? Openbmb releases bmlist to give you the answer!
XIII Actual combat - the role of common dependence
Unity 安装 Device Simulator