7 kyu
JavaScript class-like objects
10,993 of 11,235jhoffner
Description:
For this exercise you should create a JavaScript class like object called "Animal" that takes in "name" and "type" arguments. It should have a toString method that returns a human readable string indicating the argument information passed in. It should also allow the name property to be set.
The following is an example of how the final code would be used and what the expected return values should be:
let dog = new Animal('Max', 'dog');
dog.toString(); // should return 'Max is a dog'
dog.type; // should == 'dog'
dog.name; // should == 'Max'
dog.name = 'Lassie'; // should set name to 'Lassie'
Object-oriented Programming
Fundamentals
Similar Kata:
Stats:
Created | Mar 11, 2013 |
Published | Jun 24, 2013 |
Warriors Trained | 14236 |
Total Skips | 984 |
Total Code Submissions | 38026 |
Total Times Completed | 11235 |
JavaScript Completions | 10993 |
Total Stars | 54 |
% of votes with a positive feedback rating | 88% of 526 |
Total "Very Satisfied" Votes | 421 |
Total "Somewhat Satisfied" Votes | 79 |
Total "Not Satisfied" Votes | 26 |