Create a Promise with the new Promise() constructor. It takes a function with resolve and reject parameters.
const wait = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("Done!");
}, 1000);
});
wait.then(result => console.log(result));
Call resolve(value) on success, reject(error) on failure.