JavaScriptHTML + CSS + JavaScript
Draft saved locallyJavaScript · Spaces: 2
Live preview move your pointer inside
Mission 01 10 min
Reward+120 XP

Create HTML from JavaScript

JavaScript can create a new DOM element even when that element was not written in the HTML file.

const item = document.createElement("li");
item.textContent = "New item";

At this stage the item exists in memory, but it is not on the page yet.

Learn more

01
Your mission

Create a new list item when the ADD DRAGON function runs.

  • Inside addDragon(), create an li with document.createElement("li") and store it in const item.
  • Set item.textContent to 🐲 Fire Dragon.
  • Do not append it yet; that is the next mission.
Check my work Run project
Mission demoCreate HTML from JavaScript

Finished result only — the answer code stays hidden.