Y
Hacker News
new
|
ask
|
show
|
jobs
by
malft
4133 days ago
Several of the examples have an extra lambda like this. What does it do?
const toArray = (() => Array.from ? Array.from : obj => [].slice.call(obj) )();
1 comments
benjamindc
4133 days ago
It's an IFFE (Immediately-Invoked Function Expression). The goal is to perform the feature test (the availability of Array.from in this case) just once instead of for every function call.
link