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 trialDaniel Spykstra
8,496 PointsConverting GPA to a string
I'm having issues with this code challenge. I keep getting the same error message no mater what I try. It has to be a syntax issue. Can someone tell me where I'm going wrong?
class Student {
constructor(gpa){
this.gpa = gpa;
}
stringGPA() {
let GPA = this.gpa;
let gpaToString = GPA.toString();
console.log(gpaToString);
}
}
const student = new student("3.9");
student.stringGPA();
class Student {
constructor(gpa){
this.gpa = gpa;
}
stringGPA() {
let GPA = this.gpa;
let gpaToString = GPA.toString();
console.log(gpaToString);
}
}
const student = new student("3.9");
student.stringGPA();
2 Answers
jb30
44,807 PointsYour code looks fine, but the challenge wants you to return the string, not log it to the console.
Daniel Spykstra
8,496 PointsAhh now is see it. For some reason in my brain logging to the console is synonymous with returning. Thank you for your help!