I am trying to check for an object property, but I can't understand why the second option returns false. Could anyone explain? Also, are there any other better ways to check properties?
let question = {
category: 'test'
}
console.log(question.hasOwnProperty('category')); // true
this wont work
let question = {
category: 'test'
}
console.log(question.hasOwnProperty(question.category)); // false