Shortcut of calling a method without writing parameters in Javascript - Stack Overflow

PHOTO EMBED

Wed Jun 24 2020 08:59:01 GMT+0000 (Coordinated Universal Time)

Saved by @Amna #javascript

const myFunc = (...data) => (data.map((curVal,index,arr) => console.log(curVal,index,arr)))

myFunc('mango', 'apple', 'orange')
content_copyCOPY

If you're passing console.log as the callback function, you will write this:

https://stackoverflow.com/questions/62543535/shortcut-of-calling-a-method-without-writing-parameters-in-javascript