I would like to add element an array according to another array. I do something like this with Javascript but the result is always empty:
list2 = []
list1.forEach(element => {
doSomething1()
.then( something1 => { return doSomething2(something1) } )
.then( something2 => { return doSomething3(something2) } )
.then( something3 => if (something3 != null) { list2.push(element) } )
})
console.log(list2) // always empty
Can you help me?