I am facing an issue with populating an empty array named objToArray using a for-in-loop. The goal is to fill the array with numbers from a hash object checkObj, but only if the keys have values that are greater than or equal to 2.
const checkObj = {
oddNum: 1,
evenNum: 2,
foundNum: 5,
randomNum: 18
};
const objToArray = [];
for (let values in checkObj) {
if (Object.values(checkObj) >= 2 ) {
objToArray.push(checkObj.values())
}
}
console.log(objToArray);
Despite expecting three elements, [2, 5, 18], my current output is an empty array when logging objToArray.