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 trialSeth Lewis
Full Stack JavaScript Techdegree Graduate 18,191 PointsI'm attempting to translate the getArea function expression into an arrow function.
When I call getArea and pass in the "units" parameter (sqfeet, sqmeter, etc.) I get "sqfeet/sqmeter undefined". What am I missing about passing in the unit?
function getArea(width, length, unit) {
const area = width * length;
return ${area} ${unit}
;
}
getArea(36, 60, sqfeet);
2 Answers
Steven Parker
231,275 PointsThis is not related to converting to an arrow function, but t looks like you need to supply a string for the units argument.
getArea(36, 60, sqfeet); // current code, sqfeet is undefined
getArea(36, 60, "sqfeet"); // fixed
Seth Lewis
Full Stack JavaScript Techdegree Graduate 18,191 PointsThank you! I discovered that about 10 mins after posting. Felt pretty silly...
Thanks again,
SL