js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

JavaScript class-like objects #488

Closed RazvanBugoi closed 4 years ago

RazvanBugoi commented 4 years ago

https://www.codewars.com/kata/513e1e47c600c93cef000001/train/javascript

RazvanBugoi commented 4 years ago
class Animal {
  constructor(name, type) {
    this.type = type;
    this.name = name;
  }
  toString() {
     return `${this.name} is a ${this.type}`;
  }
};
RazvanBugoi commented 4 years ago

It works fine when I test it in the console.