Swapping Values Using Arithmetic Operations in JavaScript
Assume we have two variables a and b:
let a = 5;
let b = 7;
Let us swap the values. First we get the sum of the two variables and assign it to a
a = a + b; // a = 12
Now, let us reasign the value of b with the value of a by getting the difference
b =...
tiberiusmairura.hashnode.dev2 min read