Skip to content

Tag: es6-promise

Function recursion advice

I am building an employee tracking app. I want my app to work so that after each one of the functions for the various list selections is complete, the app will re-prompt you with the options list again. There are a few methods I can think of to achieve this but I was hoping a more seasoned developer could recommend

Calculate Value from JS Promise

I have assigned a callback function to a variable. The function then returns a promise stating it is fulfilled and the value. I want to be able to return the value and use it to perform a mathematical calculation. Javascript code: In the console I get the below output. Answer Assuming this is the interface you’re using, this is an

Alternative for Promise.allSettled

I am currently using Promise.allSettled to wait for all my promises to finish(irrespective of whether they resolve or get rejected). Since my project is compliant to Node v12.3.1 I am unable to use this? What other simple alternatives can I use. Sample code: Note: Promise.allSettled is available from Node version >12.9. Adding shims is also not an option. Answer There’s