|
a=b++; <=> a=b;b=b+1;
a=++b; <=> b=b+1;b=b;
a=b--; <=> a=b;b=b-1;
a=--b; <=> b=b-1;b=b;
所以,a=5;b=6;var3=a++*--b,結果為25
2.帶操作的賦值運算符等價式
a*=b; <=> a=a*b;
a/=b; <=> a=a/b;
a+=b; <=> a=a+b;
a-=b; <=> a=a-b;
a%=b; <=> a=a%b;
a&=b; <=> a=a&b; //從&=開始,下邊都是逐位運算符
a|=b; <=> a=a|b;
a^=b; <=> a=a^b;
a>>=b; <=> a=a>>b;
a<<=b; <=> a=a<<b;
a>>>=b; <=> a=a>>b; //C#沒有此運算符
JavaScript技術:JS的遞增/遞減運算符和帶操作的賦值運算符的等價式,轉載需保留來源!
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。