Exercise 3: Confirming Escaped vs. Raw Output — Possible Solution ==================================================================== SETUP ------------------------------ A page row stored with: body: "
Regular text with bold emphasis.
" TEST A — <%= %> ------------------------------Regular text with bold emphasis.
with the angle brackets shown as plain characters - nothing renders bold, and no real/ elements exist in the DOM.
TEST B — <%- %>
------------------------------
and
elements in the DOM.
WHY THIS WORKS AS AN ANSWER
------------------------------
It correctly demonstrates that <%= %> HTML-escapes its output by
default, printing tags as literal text, while <%- %> outputs the
identical string as real, unescaped HTML - concrete proof of EJS's
own two-tier output model, and of why <%- %> is the deliberate,
necessary choice for rendering page.body.