Say I have an array of objects:
const colors = [
{
name: "red",
label: "red",
colorHex: "#FF0000",
},
{
name: "blue",
label: "blue",
colorHex: "#0000FF",
},
{
name: "yellow",
label: "yellow",
colorHex: "#FFFF00",
},
{
name: "green",
label: "green",
colorHex: "green",
},
{
name: "purple",
label: "purple",
colorHex: "#800080",
},
{
name: "orange",
label: "orange",
colorHex: "#ffa500",
},
{
name: "bluegreen",
label: "blue green",
colorHex: "#0d98ba",
},
{
name: "blueviolet",
label: "blue violet",
colorHex: "#8a2be2",
},
{
name: "yellowgreen",
label: "yellow green",
colorHex: "#9acd32",
},
{
name: "redviolet",
label: "red violet",
colorHex: "#c71585",
},
{
name: "redorange",
label: "red orange",
colorHex: "#ff6600",
},
{
name: "yelloworange",
label: "yellow orange",
colorHex: "#ffae42",
},
];
I don't want to look at these objects one by one, or access it by means of indexing. Instead, I just want to take the object itself from the array that has the property name redorange
(by using a for loop or something?) from Local Storage.
Afterwards, I want to edit/change this property to let's say reddishorange
. And then put it back to Local Storage. I don't know how to do this.