How do I update first item of time using map?
const myArr = [{
day: 1,
time: [1200, 1400]
}]
newTime = 1300;
myNewArr = myArr.map(d => {
return {
day: d.day,
time: [newTime] // but this don't care about order
}
})
console.log(myNewArr)
which is 1200, replace it with says 1300, but keep 1400 as the second item? or vice versa replace 1400 with another number.
myArr[0].time[0] = 1300?spreadoperator instead