Folio3 interview question

Swap 2 numbers without any third variable .

Interview Answer

Anonymous

5 May 2021

In JavaScript we can you use array destructing to do that. let a = 2 let b = 3 [ a, b ] = [ b, a ] Now, a = 3, b = 2