Ads Top

Waypoint Testing Objects for Properties - Freecodecamp Solution

Little lost in the waypoint?

Here's the solution:

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

function checkObj(checkProp) {
  // Your Code Here
if (myObj.hasOwnProperty(checkProp)) { return myObj[checkProp];} else {return "Not Found";}
  return "Change Me!";
}

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

Keep going!!

Nenhum comentário:

Tecnologia do Blogger.