for example, I need to encapsulate a function that gets the user"s ID
getUserIds().then((ids) => {console.log(ids)})
// promise
const getUserIds = () => {
return new Promise(resolve){
//
setTimeout(() => { resolve([1,2,3]) })
}
}
// fetch
const getUserIds = () {
return fetch(URL, CONFIG)
}
what"s the difference in encapsulating interface functions with promise or fetch?