Question 9
Consider the following javascript program. What will be logged on to console after executing the program?
const promiseFactory = (data) => { return new Promise((resolve) => { resolve(data) })}result = []p1 = promiseFactory('Hello')p1.then((data) => { result.push(data) return promiseFactory('World')}).then((data) => { result.push(data)})console.log(result)[]
[‘Hello’, ‘World’]
[‘World’, ‘Hello’]
[‘Hello’]