Hello, I am learning JS Basics right now. I can´t solve the chapter:
" Basic JavaScript: Testing Objects for Properties"
even not with the helping video.
In the video seems to be a different set up than in the exercise.
The exercise says:
function checkObj(obj, checkProp) {
// Only change code below this line
return “Change Me!”;
// Only change code above this line
}
And the solution in the vid shows:
// 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”
}
}
// Test your code by modifying these values
console.log(checkObj(“gift”));
Even when I copy/ paste the solution in the exercise window it dont tell me, that I solved the exercise.
Could you help me?
Greets from Berlin,
Sebastian