- Take Home Review
- Objects
- Daily Challenge
- Classes
- Take Home Challenge
- Properties
"key: "value"
pair
- Property Keys
- Unique. No spaces. Special characters allowed if surrounded by quotes
- Property Values
- Not unique. Can be: strings, numbers, booleans, arrays, methods (functions), etc)
- Access values using dot notation
- MDN Reference: Objects
- Create a new codepen
- Congrats, you got a new dog!
- Create an object named "dog"
- Name and describe your dog
- Add a property to your dog object called "name" and assign a name
- Add two more properties to describe your dog. (ex: How many legs, fur color, etc)
- Let's teach it some tricks
- Give your dog a property called "speak" and assign a function that will alert "woof!"
- Add another method to teach your dog one more trick
- BONUS: Display your dog object values in HTML
- Create a new codepen:
- Let's say you're a car manufacturer and need to create many cars to build your inventory
- Create a
class
called "car"
- Add some properties like "make", "model", "year", "color", etc
- Use your car
class
to construct 4 (or more) different cars
- console log your code so you can see the results!
- BONUS: Display the details for each of your cars in your HTML