Can somebody help me? Here is the challenge question I'm having a hard time on:
You are provided with an object called checkObj. Using a for... in loop, determine if the object contains the property foundNum. If it exists, reassign the value of found to 1.
Here is the object:
const checkObj = {
oddNum: 1,
evenNum: 2,
foundNum: 5,
randomNum: 18
};
let found = 0;
Here is my code:
for (const prop in checkObj) {
if (checkObj.foundNum in checkObj) {
found = 1;
}
}
How do I reassign the value of a variable after running a for... in loop? Can somebody explain to me what I'm missing? Thank you very much!