0

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

Aleks G
  • 56,435
  • 29
  • 168
  • 265

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"));
xkeshav
  • 53,360
  • 44
  • 177
  • 245