-1
To having a problem of "Uncaught Referenceerror: nameValue is not defined", being that the "nameValue", is being passed to function, so no idea of what the problem.
Function :
function cleanStorage(type, namevalue){
console.log(nameValue)
if(type == 'storage'){
localStorage.clear();
return [1, 'Sucesso ao limpar storage!']
}
if(type == 'item'){
if (!localStorage.hasOwnProperty(nameValue)) {
return [0, "Erro. Item a ser exluido não exite!"];
}
localStorage.removeItem(namevalue);
return [1,'Sucesso ao exluir item!']
}
return [0, 'Erro. parametro passado é invalido'];
}
My call:
cleanStorage('item','teste')
Bro bgd, and I looked like 100 times and I didn’t realize.
– Lukas Takahashi