How to swap two numbers in Node.js

1 Answer

0 votes
let x = 91;
let y = 106;
 
console.log("x = " + x + " y = " + y); 
 
[x, y] = [y, x];
 
console.log("x = " + x + " y = " + y); 
 
 
 
 
/*
run:
 
x = 91 y = 106
x = 106 y = 91
 
*/

 



answered Nov 6, 2022 by avibootz
...