Quiz

  1. I think I would like to see more about the Partials, it seems pretty cool (and efficient)

    They are cool! Let's look at them. partials

  2. What are the limitations of EJS?

    Well, it's a special language for a special purpose: templating. I wouldn't use it for general purpose programming, like networking or machine learning. But as a templating language, it's good. I don't know of any particular thing it's missing.

    Well, Jinja2 has a feature called template inheritance, where you can have a base template, say with bootstrap and tailwind and your navbar and such all in it, and then just plug in pieces. That's pretty cool, though I'll admit that students struggle with it more than they do with EJS.

  3. Could we talk about how EJS works with cloning? How does this work with dynamic DOM elements in jQuery?

    Two entirely separate worlds. EJS works on the back end (server side) while cloning is a front-end thing. They both have the same effect, and one can imagine a site that use both. Maybe EJS renders the basic page, and front-end templating is used with Ajax updates.

  4. I'm confused about the difference between the <%= and <%- tags. What exactly is an HTML escaped value? / What does unescaped value mean?

    This is an important issue that we will talk more about later in the course. For now, let's say that HTML can be used for attacking users, particularly if it includes JS code, which it can with, say, an onmouseover attribute or even a whole script tag.

    So, if we don't trust the HTML (it's coming from user-contributed data in the the database, say), we should escape it.

    So stick to <%= unless you know what you are doing.

  5. I found the tags of EJS kind of confusing but I guess more practice will make me feel better about them

    Yes, I hope so!

  6. none for EJS, it feels familiar since it's HTML + JS

    Great! That was my goal. Some of the alternative templating engines (looking at you, Jade) are entirely new languages.