How to Swap Variables using Destructuring Assignment in JavaScript?
Destructuring assignment in JavaScript allows us to unpack the values from arrays or objects and assign them to multiple variables.Syntax// Destructuring from Array, arr = [ 10, 15 ]let [ a, b ] = arr; // a=> 10, b => 15// Destructuring from Array, obj = { n1: 10, n2: 15 ]let [ n1, n2 ] = obj;