Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function printstudent() {
var s1 = new Student("foo", 7);
console.log(s1.name);
}
printstudent(); // Student is not defined error
class Student {
constructor(name, age) {
this.name = name;
this.age = age;
}
}
printstudent(); // print foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment