+ 2

how subtraction two number, without use minus operator (-)?

use of other operators

20th Feb 2017, 10:28 PM
Mohammad Sahrayi
Mohammad Sahrayi - avatar
1 Resposta
+ 2
You could use bitwise operators JS: var a =6; var b = 2; var subtract; var subtract = a + (~b +1); console.log(subtract); //4
20th Feb 2017, 10:51 PM
tida
tida - avatar