Homework: Mid-Week Recap
Let's take a few moments this evening to reflect upon what we have studied. Below are a few problems to solve this evening that will work in what you've learned. Solve these problems and then test them in Google Chrome. Place all of these in 01_front_end_fundamentals/your_name/day3_homework.js
. We will create pull requests tomorrow in class to handle the submission.
1. Detecting Types
- Create a re-usable construct in Javascript (..you know, keeping things DRY..).
- It should accept one argument of any variable.
- This construct should return the type of the variable that is the argument.
2. Carousel
- Create an array that represents people hopping off a carousel.
- Loop through the carousel using a for loop. Every other cycle through the loop (odd), someone will hop off.
- Repeat until the carousel is empty.
3. You are an object...
- Create an object that represents yourself.
- Assign ten attributes about yourself to this object.
- Use a foreach (for-in) loop to list all of these attributes (and the keys that they are associated with).
4. Elementary School
- In elementary school, when you divide you typically use division and have to report the remainder.
- Create a function that returns a string.
- It will accept two arguments: a number, and a number to divide that number against.
- The returned string should state what the result is and the remainder.
- You will need to use the
/
and the%
operators.