DEV Community

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

Collapse
 
juanfrank77 profile image
Juan F Gonzalez

By using the ES6 destructuring assignment, that's how I would do it.

Collapse
 
theoutlander profile image
Nick Karnik

Does this solution meet memory constraints?

Collapse
 
juanfrank77 profile image
Juan F Gonzalez

In general, it does unless you're talking about very large ones.