Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Express Basics Serving Static Files in Express Merging the Design Files

Sara Bianchi
Sara Bianchi
7,630 Points

My 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.

Keith Kelly
Keith Kelly
21,326 Points

Can you please include the snippets or your code or a snapshot of your workspace? Here is a video on adding a snapshot

2 Answers

Sara Bianchi
Sara Bianchi
7,630 Points

Thanks @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
Mike Hatch
14,940 Points

Thanks, 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
Jesse Thompson
10,684 Points

Adding side to the templateData variable seemed to work for me too. Thanks