Trying to create a function that checks a password for integers and then return an object which will store a boolean representing whether the password contains an integer, and then destructure the boolean out of the function, but I keep getting this problem...
function checkForInteger(password) {
const arrayOfIntegers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
let intBoolean = {};
arrayOfIntegers.forEach((int) => {
if (password.includes(int)) {
intBoolean = { integerIsPresent: password.includes(int) };
} else {
intBoolean = { integerIsPresent: password.includes(int) };
}
});
return intBoolean;
}
checkForInteger("3gufr"); //returns {integerIsPresent:false}