0

What is the difference between nodelist and array in javascript? Can we convert array to nodelist?

Aleks G
  • 54,795
  • 26
  • 160
  • 252

1 Answers1

0

I can give you the reference at most:

nodeList

NodeList objects are collections of nodes returned by Node.childNodes and the querySelectorAll method.

Array

The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects.

And here is David Walsh's blog : Convert NodeList to Array which suggest:

var nodesArray = Array.prototype.slice.call(document.querySelectorAll("div"));
diEcho
  • 52,196
  • 40
  • 166
  • 239