# Change the specific value in a localStorage Object

I have a piece of code that is supposed to search a JSON array in localStorage and modify the isTaken value inside the specific “equipment” (for example I’m trying to take a 250ml Flask so I enter the equipment name “250ml flask” and I modify the isTaken value of that flask to true)

JSON is formatted as such:

equipmentdata = [
{
"id":1649778788049,
"isTaken":false,
"dateAdded":"Tue, 12 Apr 2022 15:53:00 GMT"
},
{
"id":1649778800655,
"isTaken":false,
"dateAdded":"Tue, 12 Apr 2022 15:53:00 GMT"
},
{
"id":1649778809178,
"name":"Measuring Cylinder",
"type":"mesCyl",
"isTaken":false,
"dateAdded":"Tue, 12 Apr 2022 15:53:00 GMT"
}
]


My JS is as follows,

function takeHandler() {
const date = new Date();
let finalD = date.toUTCString();
let teachName = document.getElementById("name").value;
let equipmentName = document.getElementById("eqname").value;
let output = teachName + " took " + equipmentName + " at " + finalD;

localStorage.setItem("equipmentTaken", null);

var eqhis = JSON.parse(localStorage.getItem("equipmentTaken")) || [];
eqhis.push(output)
localStorage.setItem("equipmentTaken", JSON.stringify(eqhis));

let finalout = localStorage.getItem("equipmentTaken");

document.getElementById("output").innerHTML = finalout;

var currentData = localStorage.getItem("equipmentdata");
currentData = currentData ? JSON.parse(currentData) : {};
currentData[eqname, isTaken] = true;
}


The main error is the the last line, I’m not really good at javascript and I cant really get the “eqname” value from the JSON and replace its “isTaken” value with true

my expected output would look like this

{
"id":1649778800655,