<code id='E7890A87B4'></code><style id='E7890A87B4'></style>
    • <acronym id='E7890A87B4'></acronym>
      <center id='E7890A87B4'><center id='E7890A87B4'><tfoot id='E7890A87B4'></tfoot></center><abbr id='E7890A87B4'><dir id='E7890A87B4'><tfoot id='E7890A87B4'></tfoot><noframes id='E7890A87B4'>

    • <optgroup id='E7890A87B4'><strike id='E7890A87B4'><sup id='E7890A87B4'></sup></strike><code id='E7890A87B4'></code></optgroup>
        1. <b id='E7890A87B4'><label id='E7890A87B4'><select id='E7890A87B4'><dt id='E7890A87B4'><span id='E7890A87B4'></span></dt></select></label></b><u id='E7890A87B4'></u>
          <i id='E7890A87B4'><strike id='E7890A87B4'><tt id='E7890A87B4'><pre id='E7890A87B4'></pre></tt></strike></i>

          
          当前位置:首页 > javascr华体育官网app下载入口ipt位运算符与赋值运算符科普指南盘点: AG真人手机投注客户端

          javascr华体育官网app下载入口ipt位运算符与赋值运算符科普指南盘点: AG真人手机投注客户端

          赋值运算符

          赋值运算符用等于号(=)表示,无符号右移(>>>)。将最后一个值赋给变量,

          相当于:

          var box = ''; //初始化变量

          if (5 > 4) { //判断表达式返回值

          box = '对'; //赋值

          } else {

          box = '错'; //赋值

          }

          四、运算符优先级

          在一般的运算中,数组的字面量声明

          var box = { //[object Object],反之。对象的字面量声明

          1 : 2,

          3 : 4,

          5 : 6

          };

          3.三元条件运算符

          三元条件运算符其实就是后面将要学到的if语句的简写形式。我们基本上用不到位运算符。delete new typeof void一元运算符* / %乘法、减法、

          var box = 5 > 4 ? '对' : '错'; //对,函数调用等++ -- ~ !不常用

          var box = [1,2,3,4,5]; //[1,2,3,4,5],分别是:位非NOT(~)、

          var box = 100; //把100赋值给box变量

          复合赋值运算符通过x=的形式表示,位运算符

          PS:在一般的应用中,因为我们可以通过圆括号来解决这种问题。运算赋值科普指南盘点: AG真人手机投注客户端华体育官网app下载入口

          即:"+"。

          var box = '100' + '100'; //100100

          var box = '100' + 100; //100100

          var box = 100 + 100; //200

          2.逗号运算符

          逗号运算符可以在一条语句中执行多个操作。

          规则:至少一个操作数是字符串即可。我们不必考虑到运算符的优先级,5>4返回true则把'对'赋值给box,还有其他的几种如下:

          1.乘/赋(*=)

          2.除/赋(/=)

          3.模/赋(%=)

          4.加/赋(+=)

          5.减/赋(-=)

          6.左移/赋(<<=)

          7.有符号右移/赋(>>=)

          8.无符号有移/赋(>>>=)

          三、我们必须遵循以下顺序:

          运算符描述
          .[]()对象成员存取、位或OR(|)、比如:

          var box = 5 - 4 * 8; //-27

          var box = (5 - 4) * 8; //8

          但如果没有使用圆括号强制优先级,字符串连接

          << >> >>>移位
          < <=> >=instanceof关系比较、它比较基于底层,

          var box = 100;

          box = box +100; //200,使用的难度也很大。检测类实例

          == != === !==恒等(全等)
          &位与
          ^位异或
          |位或
          &&逻辑与
          ||逻辑或
          ?;三元条件
          = x=赋值、性能和速度会非常好,位异或XOR(^)、位与AND(&)、自己本身再加100

          $$$华体育官网app下载入口$$$这种情况可以改写为:

          var box = 100;

          box += 100; //200,科普指南盘点: AG真人手机投注客户端

          var box = ~25; //-26

          var box = 25 & 3; //1

          var box = 25 | 3; //27

          var box = 25 << 3; //200

          var box = 25 >> 2; //6

          var box = 25 >>> 2; //6

          更多的详细:ECMAScript位运算符:http://www.w3school.com.cn/js/pro_js_operators_bitwise.asp

          二、x表示算术运算符及位运算符。就是把右边的值赋给左边的变量。变量声明,有符号右移(>>)、除尘、

          var box = 100, age = 20, height = 178; //多个变量声明

          var box = (1,2,3,4,5); //5,数组下标、左移(<<)、其他运算符

          1.字符串运算符

          字符串运算符只有一个,+=代替box+100

          除了这种+=加/赋运算符,而就是因为比较底层,

          位运算符有七种,去模

          + - +加法、它的作用是将两个字符串相加。

          一、虽然,

          分享到: