JS Expression and Operator Simple Operation Example

This example describes the simple operation of JS expression and operator. Share to everyone for reference, specific:

 / *** Created by Administrator on 2017/12 / 14. * Expressions and Operators * /// 1 Basic expression increase and decrease multiplication var A = 4; a = 7/6; var b = (a + 4) /2; console.log (a); console.log (b); console.log ("== ======== "); // end // 2. Comparison operator ==! =>  =  1) && (a <=
console.log(a  < 2);
console.log(ret);
console.log(true && false);
console.log("==========");
//end
//4.字符串
a = 10;
b = 20;
var num_str = "" + a + b + true;
console.log(num_str); //1020true
num_str = a + b + true + "";
console.log(num_str); //31
console.log("==========");
//end
//5.简约表达式 += -= *= /= ++ --
var c = null;
a += c; //a = a + c
a -= c; //a = a - c
a *= c; //a = a * c
a /= c; //a = a / c
a = 10;
a++; //a = a + 1 先参与运算,最后自增
++a; //a = a + 1 先自增在参与运算
console.log(a);
a--; //a = a - 1 先参与运算,最后自减
console.log(a);
--a; //a = a - 1 先自减在参与运算
a = 4;
console.log(a++);
console.log(++a);
// end

 

js表达式与运算符简单操作示例

Interested friends can use

online HTML / CSS / JavaScript code running tool js表达式与运算符简单操作示例: Http: //tools.jb51.net/code/htmljsrun Tests the above code running effect.

More about JavaScript Related Contents View this Topic: “JavaScript Operation DOM Skill Summary”, “JavaScript page Element Operation Skills Summary “ I hope this article will help you JavaScript programming.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment