I want to create an Array of objects in a messages constant which are 3 keys /values : author, hour and message
Problem : some object have a blank author value, and I want to get the previous iteration author key/value in the .map function itself to replace the blank value (current iteration)
Is it possible to get the previous iteration element in the .map function even if the iteration is not yet finished ?
Thanks a lot for your help
From this
0:
author: "Kara"
hour: "19:32"
message: "Salut Mia merci pour ton ajout cela va me servir de test !"
1:
author: ""
hour: ""
message: "Ceci est un test : message 2 !!"
To this :
0:
author: "Kara"
hour: "19:32"
message: "Salut Mia merci pour ton ajout cela va me servir de test !"
1:
author: "Kara"
hour: "19:32"
message: "Ceci est un test : message 2 !!"
I want to copy the previous iteration object values.