We'll practice using constructors and assigning to object prototypes in Javascript.
- Javascript constructors
- Javascript prototypes
- Browser tools
We've assembled some challenges covering Javascript constructors and prototypes. We'll complete these challenges in such a way that we can test the solutions using our browser's Javascript console.
Challenge 1.1: Download constructors.js
and include it in a simple webpage called index.html
. Complete challenge #1 through #5 inside constructors.js
. Open your webpage locally and use your browser's console - if you see "Assertion failed", you need to recheck your work.
Goal 1.1: Upload both files to Github pages and submit your page's URL below.
Challenge 2.1: In addition to Explore's objectives, complete the "Bonus" challenge in constructors.js
.
Goal 2.1: Submit your Github page URL below.
Challenge 3.1: In addition to Adventure's objectives, create a new file called animal.js
. Include it in your index.html
and, without changing your solutions to constructors.js
, add a method called walk()
to both Cat & Dog's prototypes. Cat.walk()
should return the string "Nope", and Dog.walk()
should return "Hooray!". Make sure you add animal.js
to your page and update your Github page.
Goal 3.1: Submit your URL below.
- Github Pages URL