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

Rod R
Rod R
3,050 Points

'undefined' error for template literal practice

https://w.trhou.se/2qua3afduo

my practice code updates aren't working- the html displays 'undefined' and I found no js errors in the console. where did I go wrong?

2 Answers

All I did was delete the extra line after your return statement here:

function createPlanetHTML(planet) {
 return `<div class="card"> 

and it appears to be working

https://w.trhou.se/i6fj5ptujv

Emmanuel C
Emmanuel C
10,636 Points

It would be safer to put that string in a variable and return the variable instead.

Rod R
Rod R
3,050 Points

Thank you both