I am looking at for..in tutorial from MDN documentation
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in
The example iterates over the object's properties and prints all. I am trying to print only if value of object's property is 3. Can someone please help me understand where I am going wrong. And also if possible explain.
const object = { a: 1, b: 2, c: 3 };
for (const property in object.c == 3) {
console.log(`${property}: ${object[property]}`);
}