Homework for GA - Javascript Development
Regular Expressions with Iterators Lab / Homework
-
For this exercise we will be working with this array: ["Cat", "Dog", "Polar Bear", "Grizzly Bear", "Antelope", "Kangaroo", "Bear"]
-
Using .filter()
- Return an array with only animals that have three-letter names.
- Return an array with only animals that have two-word names.
- Return an array with only animals that don't start with the letter K.
-
Using .map()
- Return an array that changes all animal names containing "bear" to "Teddy Bear".
- Write a regular expression that checks if the animal is either cat or dog. If it is cat, replace the value with "Kitty Cat" and if it is a dog replace the value with "Puppy".
-
Bonus: Use constructors and prototypes to set this functionality up in an object-oriented way.