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 trialSara Bianchi
7,630 PointsMy class with 'side' variable is undefined!
In my file card.pug, the 'side' variable is undefined and my class that has to change words 'question' and 'answer' doesn't work. Also h1.card-title= side is undefined but the rest work. I tried to change interpolation with chaining but nothing, I might have something wrong in cards.js?
Thanks in advance.
2 Answers
Sara Bianchi
7,630 PointsThanks @Keith Kelly This is my snapshot: https://w.trhou.se/7xze3pblv9 I just loaded the cards.js file because I programmed it with Visual Studio Code: Maybe I've already found a solution to my problem, I added the parameter 'side' in 'const templateData' like this: const templateData = { id, text, name, side};
Mike Hatch
14,940 PointsThanks, Sara. I, too, added the side
parameter and got it to work.
Also, if anyone else has issues with their images not displaying move the img
folder into the public
folder. When you watch the video it looks as if the img
and stylesheets
folders are in the root folder.
Jesse Thompson
10,684 PointsAdding side to the templateData variable seemed to work for me too. Thanks
Keith Kelly
21,326 PointsKeith Kelly
21,326 PointsCan you please include the snippets or your code or a snapshot of your workspace? Here is a video on adding a snapshot