How to check if two integers have opposite signs in Node.js

1 Answer

0 votes
let x = -849, y = 561;            
let b = ((x ^ y) < 0); 
console.log(b);
      
x = 1290, y = 8913;
b = ((x ^ y) < 0); 
console.log(b);
      
 
    
/*
run:
     
true
false
      
*/

 



answered Jul 24, 2025 by avibootz

Related questions

...