4 ms·
Several of the examples have an extra lambda like this. What does it do? const toArray = (() => Array.from ? Array.from : obj => [].slice.call(obj) )();
by malft 12y 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)
)();
- benjamindc 12y agoIt'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.