FrontendInterviews.dev

657. in vs hasOwnProperty

Easy•

Predict the output.

const proto = { a: 1 }
const obj = Object.create(proto)
console.log("a" in obj, Object.prototype.hasOwnProperty.call(obj, "a"))

What is printed in the console?

Select an option and submit your answer.
Next Problem