Home > Enterprise >  What does an array with the value #text in the index 0 mean?
What does an array with the value #text in the index 0 mean?

Time:06-02

What does an array with the value #text in the index 0 mean And where did it come from? I explained my meaning below.

this is HTML code:

<div >
    <div >
  
    </div>
  </div>

and this is JS code:

const todoList = document.querySelector(".todoList");
 
//function

function filtersTodo(e) {
const todos = [... todoList.childNodes];
console.log(todos);
}

And this is what it shows me as output:img of output console.log(todos)

another picture

My question is where Array [#text] came from and why?

CodePudding user response:

"Everything in the DOM is represented by a node. Including plain text."

See this post: https://stackoverflow.com/a/21357034/16633894

  • Related