This page aims to save contacts' information, including their names, cities and emails.
if(inputName.length === 0) {
alert('Name is required');
} else if (inputCity.length === 0) {
alert('City is required');
} else if (inputEmail.length === 0) {
alert('Email is required')
} else if (!emailRegex.test(inputEmail)) {
alert('A valid email is required')
} else {
for(let i = 0; i < arr.length; i++) {
contact.innerHTML = `Name:${arr[i - 2]}<br>City:${arr[i - 1]}<br>Email:${arr[i]}`;
contacts.insertBefore(contact, contacts.children[0]);
}
}
})
This webpage is prepared to launch, users can click the link to preview it.
Click here to view the contact webpage