JavaScript Express Basics Parameters, Query Strings, and Modularizing Routes Randomize Cards

Hamzah Iqbal
seal-mask
.a{fill-rule:evenodd;}techdegree
Hamzah Iqbal
Full Stack JavaScript Techdegree Student 11,144 Points

Cant we just use a(href=`${id}?side=${showSide}`)

I can't see why we would need to use:

a(href=${id}?side=${showSide}) = showSideDisplay

When looking at the URL, it consists of the ID + ?side= + answer/question Why is it then stored in the variable? I can see that it's used to capitalize it, but does it have any other functionality than that?

Carlos Chavez
Carlos Chavez
5,502 Points

Hi Hamzah, if I understood correctly, you're asking why not just leave out the 'showDisplay'?

extends layout.pug

block content
  section#content
    h2= text
    if hint
      p
        i Hint: #{hint}
    a(href=`${id}?side=${showSide}/`)

if you tried this solution, you probably saw that the text didn't render on the page. If we don't put anything there, then it'll be blank on the link that will take us to the other side of card, like writing "<a></a>" Remember that this text needs to change between answer-question, depending on the page that's being displayed, and that what the 'showDisplay' local variable does.