Ready. Start with one instruction.
Loading the learning workspace…
FROM YOUR FIRST INSTRUCTION TO A WORKING APPLICATION
Learn JavaScript from scratch through small working examples, visual experiments and complete projects. No account or AI key required.
Predict → Experiment → Build → Test → Explain
Ready. Start with one instruction.
Loading the learning workspace…
HTML describes the initial document. The browser builds a tree of objects from it. JavaScript can change those objects after the page loads, so the visible page need not match its original source. In this studio the HTML fixture is created before your code runs. Select the heading, then assign a new textContent value; the change is visible immediately. This is a DOM update, not a change to the HTML file on disk. HTML creates the elements, CSS styles them, and JavaScript changes behavior. The preview contains real elements in an isolated document.
document.querySelector('#welcome').textContent = 'Hello, DOM!';Run the preview tests; inspect the live page.
HTML describes the initial document. The browser builds a tree of objects from it. JavaScript can change those objects after the page loads, so the visible page need not match its original source. In this studio the HTML fixture is created before your code runs. Select the heading, then assign a new textContent value; the change is visible immediately. This is a DOM update, not a change to the HTML file on disk.
document.querySelector('#welcome').textContent = 'Hello, DOM!';Read or update literal text in the selected element. It does not parse user input as HTML.
document.querySelector('#welcome').textContent = 'Hello, DOM!';
console.log(document.querySelectorAll("*").length);Interact with the preview; the diagnostic displays its actual element count.
HTML describes the initial document. The browser builds a tree of objects from it. JavaScript can change those objects after the page loads, so the visible page need not match its original source. In this studio the HTML fixture is created before your code runs. Select the heading, then assign a new textContent value; the change is visible immediately. This is a DOM update, not a change to the HTML file on disk. HTML creates the elements, CSS styles them, and JavaScript changes behavior. The preview contains real elements in an isolated document. The final diagnostic counts actual matching elements. Read querySelectorAll as a selection and length as the collection count.
document.querySelector('#welcome').textContent = 'Hello, DOM!';Read or update literal text in the selected element. It does not parse user input as HTML.
console.log(document.querySelectorAll("*").length);Evaluate the argument and display its value at this point. Quoted text is literal; an unquoted identifier reads its current binding.
document.querySelector('#welcome').textContent = 'Hello, DOM!';
console.log(document.querySelectorAll("button").length);Interact with the preview; the diagnostic displays its actual element count.
HTML describes the initial document. The browser builds a tree of objects from it. JavaScript can change those objects after the page loads, so the visible page need not match its original source. In this studio the HTML fixture is created before your code runs. Select the heading, then assign a new textContent value; the change is visible immediately. This is a DOM update, not a change to the HTML file on disk. HTML creates the elements, CSS styles them, and JavaScript changes behavior. The preview contains real elements in an isolated document. The final diagnostic counts actual matching elements. Read querySelectorAll as a selection and length as the collection count.
document.querySelector('#welcome').textContent = 'Hello, DOM!';Read or update literal text in the selected element. It does not parse user input as HTML.
console.log(document.querySelectorAll("button").length);Evaluate the argument and display its value at this point. Quoted text is literal; an unquoted identifier reads its current binding.
Change #welcome to exactly Hello, DOM!
// Change #welcome to exactly Hello, DOM! // Write your JavaScript below.
document.querySelector('#welcome').textContent = 'Hello, DOM!';querySelector returns an element; textContent controls its text.
Which operation changed the result, why did it work, and what would you test next?
Use a different value that could expose a boundary or mistake. Predict the result first, run it, and explain how the concept would help in a small real application.
Related: Previous lesson Next lesson
100 lessons across 20 modules, covering variables, operators, strings, conditions, loops, functions, scope, arrays, objects, DOM, events, state, testing, asynchronous JavaScript and application development.