I was trying this simple freecodecamp.org exercise, and was running into a problem with my solution.
What I can't work out is why these two functions return different results:
let someArray = {
Person: {
age: 27,
online: true
}
};
function works(obj) {
return ('Person' in obj);
}
console.log("works returns:" + works(someArray));
function doesNotWork(obj) {
return
('Person' in obj);
}
console.log("doesNotWork returns:" + doesNotWork(someArray));
The results of running this on node.exe v10.8.0
Why is the second function returning undefined.