Previously, I stored various objects in localStorage in the following format:
console.log(localStorage)
// The storage output may vary, with different objects (such as randid)
Storage {
876346545: "{"ABA":"876346545","ABB":"37578533567","ABC":"AE123456","ABD":"1234567890123456"}",
randid: "fhjidc06om230j2r367gh1i5iec",
353446545: "{"ABA":"353446545","ΑBB":"12343212341","ΑBC":"CC949590","ABD":"5943949562340543"}",
length: 3
}
I am attempting to check if a specific pair exists within this array of objects.
//Pseudo-code
if anyofObject in localStorage contains pair ("ABA":"876346545") return true or false
The code I'm using isn't behaving as expected
var data = JSON.parse(localStorage) // I've also tried without parsing it as JSON
for (var key in data) {
if (data[key].ABA = "876346545") {
var m = data[key];
console.log("Found: ", m)
break;
}
}