const validation = () => {
const arr = []
const obj = {}
arr.push(yup.string().optional())
for (let i = 1; i < 100; i++) {
arr.push(obj[i] = yup.string().required('Нужен ответ на вопрос'))
}
return arr
}
const schema = yup.object().shape({
...validation()
})
var usersData = [];
var userObj = {name: '', email: '',id: i = 0};
function AddUser(name, email, id) {
usersData.push({
name: name,
email: email,
id: i++
});
}
function UpdateUser(id, name , email) {
usersData.forEach(function (item, i, usersData) {
usersData[id].email = email;
usersData[id].name = name;
})
}
function DeleteUser(id) {
delete usersData[id];
}
function ShowUsers() {
console.log(usersData);
}