0
I have an empty array that receives via push the content of the localstorage (which is also an array),
however, when I give a.find vector to find the value of an attribute, such as _name, it does not return the result, presenting the Undefined error.
const vetor = []
vetor.push(window.localStorage.getItem ('localCadastro'));
const resultado = vetor.find (atributo => atributo._nome == 'teste');
when I give a console.log (vector), the result is this:
["[{\"_cpf\":\"\",\"_conta\":\"\",\"_nome\":\"teste\"}]"]
but when I give a console.log (result), the result is this:
undefined
I want to use find to find a specific content in the array that is in localStorage.
ps: I use window.localStorage because I am trying to query localStorage of index.html and localstorage is being saved in another.html deletine.
It worked, thank you!
– Gabriel Claudino Marinho