Exercise - Objects

by Jason Aden

JavaScript

/**
 * Objects and Functions (Basics)
 */

// 1)
//
// create a function named "reveal" that takes an object as its only argument
// for each property in the object, the function should output 
// the property name, value and type of the value to the console
// hint: you will use a for...in loop
// 
// Example: 
//     reveal({firstName: "Ryan"}); -> "firstname Ryan string"
/*
var user = {
    name: "Your Name",
    awesome: true
}l

reveal(user);
*/

// 2) 
//
// Update your "reveal" function and make sure you are
// iterating ONLY the properties the object owns
// hint: you will use hasOwnProperty()

// 3) Bonus
//
// Set up your "reveal" function
// so it is a method ON the object you created above
// hint: you'll need to use "this" in the new method
// ex usage: yourObject.reveal();