That I can explain easily.
" Welcome to " is a child of this span. You see this by watching your HTML code.
<span> everything inside angle brackets > and < is a child of the surrounding HTML element.</span>
When you access the span via
const mySpan = document.getElementsByClassName('1234124655G')
You get an array with at least the span from above inside.
In your browser, you can run console.dir(mySpan) to see the structure of this array. You'll quickly spot that the span has some children of its own. console.dir(mySpan[0].childNodes) returns a list with three elements inside - a text element, a strong element and again a text element. The first text element holds your desired text.
console.dir(mySpan[0].childNodes[0].data) // " Welcome to "
console.dir(mySpan[0].childNodes[0].nodeValue) // " Welcome to "
console.dir(mySpan[0].childNodes[0].textContent) // " Welcome to "
console.dir(mySpan[0].childNodes[0].wholeText) // " Welcome to "
@hipkiss91 .children holds only a list of HTML elements. Your text is just text, and you can't find in .children. About your first question. No. .childNodes[0] holds either undefined or the thing in this array at position one. This position one thing can be anything. It depends on the HTML structure and how you identify this element. document.getElementsByClassName or document.getElementById or document.getElementsByName or document.getElementTagName this for methods can find your desired element(s) in a document but the element which has a reference to " Welcome " may not always sit at position 0.