I have a object variable and i want to push into my object a new { key: "value" } but with a loop and using loop index.
Something like this:
let headers = {
product_title: "Product Name",
action: "Status",
quantity: "Quantity",
priority: "Priority",
};
for (let i = 0; i < bigger; i++) {
headers = { ...headers, ...{ 'org_{i}': i } };
}
is there a way to do something like this or add unique key with indexes?
Finally i need something like below:
let headers = {
...old data
key_1: "",
key_2: "",
key_3: "",
};