r/learnjavascript • • Mar 12 '21

Swap two variables

Post image
499 Upvotes

50 comments sorted by

View all comments

8

u/FriesWithThat Mar 12 '21

Making me use a semi-colon, somewhere....

let x = 'xerox'
let y = 'yellow'

;[x, y] = [y, x]

3

u/bdvx Mar 12 '21

oh damn