Advertisement
728x90
The Instance properties must be defined inside of class methods. For example, name and age properties defined inside constructor as below,
javascript
1class Person {
2
3constructor(name, age) {
4 this.name = name;
5 this.age = age;
6}
7}But Static(class) and prototype data properties must be defined outside of the ClassBody declaration. Let's assign the age value for Person class as below,
javascript
1Person.staticAge = 30;
2
3Person.prototype.prototypeAge = 40;Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 79
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
422of476