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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Tara K](https://uploads.teamtreehouse.com/production/profile-photos/11537181/micro_A1A950BB-96D0-4A43-A5D6-841C6F5AE6D1-2.jpg)
Tara K
1,863 PointsDefault parameter not working.
This is my code. When I run it in the console I get the correct calculated number, but units show up as 'undefined' instead of the default 'sq ft'
function getArea(width, length, unit = 'sq ft') {
let area = width * length;
return ${area} ${unit}
;
}
getArea(2, 3);
1 Answer
![Dimitar Dimitrov](https://uploads.teamtreehouse.com/production/profile-photos/10835372/micro_84484695-cartoon-ninja-drawing-in-chibi-manga-style-cute-vector-illustration-.jpg)
Dimitar Dimitrov
11,800 PointsAfter the return statement you need to use template literals if you want to display all the data. You forgot the `` which signals the start of the template literal
function getArea(width, length, unit = "sq ft") {
let area = width * length;
return `${area} ${unit}`;
}
Tara K
1,863 PointsTara K
1,863 PointsOf course! Thanks so much :)