How to double a variable with bitwise shift left in Node.js

1 Answer

0 votes
let num = 9;

num = num << 1;  // This will double the value of num

console.log(num);

 
 
/*
run:
 
18
 
*/

 



answered Mar 9, 2025 by avibootz

Related questions

1 answer 91 views
1 answer 95 views
1 answer 93 views
1 answer 88 views
1 answer 81 views
1 answer 96 views
1 answer 124 views
...