Appearance
function delay(fn, wait, ...args) { return new Promise((resolve) => { setTimeout(() => { resolve(fn(...args)) }, wait) }) }
function foo(num) { return num } delay(foo, 2000, 10).then(res => console.log(res)) // 10