0 points

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


dashboard

Wed Jun 24 2020 08:59:01 GMT+0000 (UTC)

Posted by @Amna #javascript

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

myFunc('mango', 'apple', 'orange')
content_copy Copy

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