Fastest way to convert JavaScript NodeList to Array?

前端 未结 13 1695
清酒与你
清酒与你 2020-11-22 16:48

Previously answered questions here said that this was the fastest way:

//nl is a NodeList
var arr = Array.prototype.slice.call(nl);

In benc

相关标签:
13条回答
  • 2020-11-22 17:54

    Check out this blog post here that talks about the same thing. From what I gather, the extra time might have to do with walking up the scope chain.

    0 讨论(0)
提交回复
热议问题