I wrote a function in javascript expression to check if the result is true or false but i am always getting undefined error
var array = [{
email: '[email protected]',
password: '123'
},
{
email: '[email protected]',
password: '123'
}
];
let main = function(email, password) {
return array.forEach((row) => {
if (row.email === email && row.password === password) {
return true
} else {
return false
}
});
};
var checkLogin = main('[email protected]', '123');
console.log(checkLogin)
checkLogin always return undefined
array.forEachdoesn't return anything. I think you meant to usemap