Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

swap function javascript

let a = 1;
let b = 2;

a = a ^ b;b = a ^ b;a = a ^ b;
a; // => 2
b; // => 1
Source by dmitripavlutin.com #
 
PREVIOUS NEXT
Tagged: #swap #function #javascript
ADD COMMENT
Topic
Name
4+3 =