Skip to content

Instantly share code, notes, and snippets.

@mokyox
Last active March 3, 2017 02:20
Show Gist options
  • Save mokyox/b25d9a1ebbe78014038800a9706b61f8 to your computer and use it in GitHub Desktop.
Save mokyox/b25d9a1ebbe78014038800a9706b61f8 to your computer and use it in GitHub Desktop.

Hey guys, got a problem with the Testing Objects for properties lesson. I'm trying to find a way to return all the values of the object myObj but I can't seem to find the answer online. Any ideas?


// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  
 
  if (myObj.hasOwnProperty("gift" || "pet" || "bed")) {
    return myObj; //Object value?
  }
  
 else {
  return "Not Found";
}

}

// Test your code by modifying these values
checkObj("gift");



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment