``const users = [
{
_id: 'ab12ex',
username: 'Alex',
email: 'alex@alex.com',
password: '123123',
createdAt:'08/01/2020 9:00 AM',
isLoggedIn: false
},
];
function makeid(length) {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
let counter = 0;
while (counter < length) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
counter += 1;
}
return result;
}
function signUp([Email, username, password]){
if(users.find(Email=>users.email===Email)===true){
console.log('You alreaday have an account. Please head to the signin page instead.')
}
else{
let u = Object.assign({}, user[0])
users.push(u)
return("You've made a new profile.")
}
}
console.log(signUp(["user@user.com", "user", "231235"]))``
In the program what I'm trying to do is take one of the objects from the array and modify it so that it equals the email and stuff I set for it.