I have this array:
const arr = [2, 4, 8, 12, 15, null, null, null, 18, 39, null, 49, null, null]
How can I update the null value in this array with the last defined value until the next defined value and stop if there is no more defined value at the end.
So it looks like this:
const arr = [2, 4, 8, 12, 15, 15, 15, 15, 18, 39, 39, 49, null, null]
null, null]at the end of your desired result doesn't match your expressed expectations.