DEV Community

Discussion on: How can you swap two variables without using a third?

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦
let x = 1
let y = 2
[x, y] = [y, x]
x // 2
y // 1