I am having an issue with a JavaScript for-in loop.
Why does console.log(user) display the number "0" when iterating through users?
Is it indicating the index of the user object in the array?
I would like to log each object individually...
Thank you
router.post("/api/verification/check", auth, async (req, res) => {
try {
const users = await User.find({ /* retrieve users */ })
console.log(`${users}`) // displays user object
for (const user in users) {
console.log(user) // shows "0" ???
}
} catch (err) {
res.status(400).send()
}
}
)