I want to redirect a user to a new page if their login details are correct. However, when I use the window.location.href("portal.html") in a simple if statement to check if user details match an already stored data in a variable, it works, but when I use it in a for loop to loop through an array of stored data it doesn't render the the portal.html page.
please help, Thanks.
for(let i = 0; i<= objPeople.length; i++){
if(name === objPeople[i].username && pass === objPeople[i].password){
window.location.href="portal.html"
return
}
} console.log("incorrect login details");