Read object data from externel file into const object1

61 Views Asked by At

Instead of having the data array in the js-file I would like to read the "Object data" from an external file.

const object1 = {
        Day_1:89,
        Day_2:80,
        Day_3:78,
        Day_4:83,
        Day_5:89,
        Day_6:89,
        Day_7:80,
        Day_8:78,
        Day_9:78,
        Day10:83,
        Day11:89,
        Day12:80,
        Day13:78,
        Day14:83
};

for (const [key, value] of Object.entries(object1)) {
  console.log(`${key}: ${value}`);
}
0

There are 0 best solutions below