JavaScript Object-Oriented JavaScript Getters and Setters Creating Getter Methods

empty getter method

i cant write the code for creating an empty getter method.

creating_getters.js
class Student {
    constructor(gpa, credits){
        this.gpa = gpa;
        this.credits = credits;
    }

    stringGPA() {
        return this.gpa.toString();
    }
}

const student = new Student(3.9);

1 Answer