Define a function to take configuration object as input:
const func = ({a=1, b=2}) => { return a+b; } console.log(func({b:4})) //output: 5
Swap 2 vars without a 3rd var:
let a = 1, b = 2; [b, a] = [a, b] console.log(a, b) //output: 2 1
For more info: