I need a solution to add some values from an Object (weekdayMap) into an existing array (vehicleAvailabilities) with objects in it. On day one i need the value Montag on day 2 the value Dienstag
and so on
I need the result like this:
const result = [
{id: 1, day: "1", value: true, weekday: 'Montag'},
{id: 2, day: "2", value: true, weekday: 'Dienstag'} ...
from this both:
const vehicleAvailabilities = [
{id: 1, day: "1", value: true},
{id: 2, day: "2", value: true},
{id: 3, day: "3", value: true},
{id: 4, day: "4", value: true},
{id: 5, day: "5", value: true},
{id: 6, day: "6", value: false},
{id: 7, day: "7", value: false}
]
const weekdayMap = {
1: 'Montag',
2: 'Dienstag',
3: 'Mittwoch',
4: 'Donnerstag',
5: 'Freitag',
6: 'Samstag',
7: 'Sonntag'
}