DEV Community

Discussion on: Swapping two numbers, w/o a temp variable

Collapse
 
joelnet profile image
JavaScript Joel

Swapping two objects, w/o a temp variable

const K = a => b => a

let a = 'A'
let b = 'B'

a = K(b)(b = a)

a //=> 'B'
b //=> 'A'