Hallo. After a class is deleted (it’s stored in an object
that’s been push into an array
, which I dubbed n
), the find code is not working. It reads on the console
:
Uncaught TypeError: (destructured parameter) is undefined
foundIdade file:///Users/myname/Desktop/practice BC/cadastro/js/cadastro-6.js:63
find file:///Users/myname/Desktop/practice BC/cadastro/js/cadastro-6.js:63
onclick file:///Users/myname/Desktop/practice BC/cadastro/cadastro-6.html:1
I’ve been trying to solve this issue for some time but to no avail. I tried to decrease the classes’ keys (if the #2 is erased, you get 0, 1, 3 ), but it didn’t work. Here’s my code:
let find2;
function find() {
find2 = document.getElementById('find');
let foundNome = n.find(({name}) => name === find2.value);
let foundIdade = n.find(({age}) => age === find2.value);
let foundEmail = n.find(({email}) => email === find2.value);
let foundId = n.find(({id}) => Number(id) === Number(find2.value));
if(typeof foundAge !== 'undefined' && typeof foundName !== 'undefined' && typeof foundId !== 'undefined') {
if(foundName.name !== find2.value) {
}
if(foundAge.age === find2.value) {
};
if(foundEmail.email === find2.value) {
};
if(Number(foundId.id) === Number(find2.value)) {
};
};
console.log(foundName);
console.log(foundAge);
console.log(foundEmail);
console.log(foundId);
document.getElementById('find').value = '';
};
let deleteInfo;
function deleteContent() {
deleteInfo = document.getElementById('delete');
delete n[clockContainer.get(deleteInfo.value)];
delete containerDataStudents[clockContainer.get(deleteInfo.value)];
document.getElementById('delete').value = '';
};
Thanks and I appreciate the help.