Project 29: E-commerce Cart
JS Wizard
Builds on these lessons
Step 1 of 3
Project
textContent, Not innerHTML
Render a customer's coupon note into the page with element.textContent, never element.innerHTML. innerHTML parses its string as real markup — a coupon note like <img src=x onerror=alert(1)> would execute as code. textContent always treats the string as plain, inert text.
🎯 Your Task
Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!
const couponNote = "<img src=x onerror=alert(1)>";
const noteElement = document.querySelector(".coupon-note");
noteElement.textContent = couponNote;