DEV Community

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

Collapse
 
liloow profile image
Tom

No need to go very far... and it will never cause overflow

x.__proto__.y = y
y.__proto__.x = x
x = x.y 
y = y.x