1.

What is parameter destructuring?

Answer»

PARAMETER destructing allows a function to unpack the object provided as an argument into ONE or more local variables.

function multiply({ a, b, c }: { a: number; b: number; c: number }) {console.log(a * b * c);}multiply({ a: 1, b: 2, c: 3 });You can simplify the above CODE by using an interface or a named TYPE, as follows:type ABC = { a: number; b: number; c: number };function multiply({ a, b, c }: ABC) {console.log(a * b * c);}multiply({ a: 1, b: 2, c: 3 });


Discussion

No Comment Found