Answers for "Swap values with array destructuring"

0

Swap values with array destructuring

let a = 1, b = 2
[a, b] = [b, a]
console.log(a) // -> 2
console.log(b) // -> 1
Posted by: Guest on November-21-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language