In this practice, you will use ES6 class syntax to define classes and monkey-patch an existing class.
Clone the starter from the Download link at the bottom of this page.
Run npm install
to install any dependencies.
Take a look at the classes/dog.js file. The test specs for the Dog
class
in the test/dog-spec.js file are already passing. Refactor the Dog
class
to use ES5 class syntax instead. Test your code to make sure it still works
after the refactor by running the following command:
npm test test/dog-spec.js
Take a look at the classes/person.js file. The test specs for the Person
class in the test/person-spec.js file are already passing. Refactor the
Person
class to use ES5 class syntax instead. Test your code to make sure it
still works after the refactor by running the following command:
npm test test/person-spec.js
Finally, take a look at the classes/array.js file. Monkey-patch the Array
class so that all the test specs in the test/array-spec.js file pass. Run
the test specs with the following command:
npm test test/array-spec.js
Hint:
The method you are adding to theArray
class tests if two arrays are deeply equal.