DEV Community

Discussion on: How Classes work in JavaScript

Collapse
 
mario_tilli profile image
Mario Tilli

That's a good explanation! I would like to contribute to your post, in case someone wants class Student parameters marked as private.

class Student{


  constructor(n,a){
    var name;
    var age;
    name = n;
    age = a;
    this.getAge = function() {
       return age;
    }
    this.getName = function() {
       return name;
    }
  }
}