What is the most efficient way to filter or map a nodelist in ES6?
Based on my readings, I would use one of the following options:
[...nodelist].filt
TL;DR;
Array.prototype.slice.call(nodelist).filter
The slice() method returns an array.
That returned array is a shallow copy of collection (NodeList)
So it works faster than Array.from()
So it works as fast as Array.from()
Elements of the original collection are copied into the returned array as follows:
Short explanation regarding arguments
Array.prototype.slice(beginIndex, endIndex)
Array.prototype.slice.call(namespace, beginIndex, endIndex)