When we create a Promise(), the constructor expects two parameters: resolve and reject.
Can I create a Promise using only resolve?
let promise = new Promise((resolve) => {});
I've tried and it works. But, it is a good practice? The promise is expected to be resolved in all circumstances.
Yes, it's doable. If
reject parameter wouldn't be used anyway)then using only the resolve parameter is a reasonable possibility.
If there's any chance of an error - even an unexpected error - it'd be a good idea to use the reject parameter, though. Many errors are not expected, after all.
yes you can with
Promise.resolve(value);
refer https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve