Tell us what’s happening:
How should i set it if the property is found. To true?
I can’t simpley seems to use if property XX === true
Your code so far
// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
// Your Code Here
if myObj.hasOwnProperty("gift"); //pony
else myObj.hasOwnProperty("pet"); // kitten
return "Not Found";
}
// Test your code by modifying these values
checkObj("gift");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.2 Safari/605.1.15
.
Challenge: Testing Objects for Properties
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties