Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,145 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?

1 Answer

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.