不用加减乘除做加法
2020-04-29 本文已影响0人
六寸光阴丶
var add = function(a, b) {
while(b != 0) {
let tmp = a ^ b
b = (a & b) << 1
a = tmp
}
return a
};
var add = function(a, b) {
while(b != 0) {
let tmp = a ^ b
b = (a & b) << 1
a = tmp
}
return a
};