+ 1

explain about why {...} use here ?

let {log} = console ; log("what?"); Result => what? i don't understand well this code...

24th May 2020, 10:19 AM
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎ - avatar
4 Answers
+ 5
console.log added to object In every calling of object log function gets data and printing it!
24th May 2020, 10:26 AM
Shahghasi Adil
Shahghasi Adil - avatar
+ 3
let {log} = console; is equivalent to let log = console.log; This technique is called object destructuring.
24th May 2020, 10:37 AM
Michael
Michael - avatar
+ 3
This statement release methods to functions or properties to value(s): Examples: const {log: LOG= alert} = console; // LOG('OUTPUT'); // will consoled if there is a log method in console object if it is not will use the alert replace it log: LOG is the function name in constant
24th May 2020, 11:52 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 1
thank for responds guys
12th Jun 2020, 12:56 PM
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎ - avatar