Skip to content

Instantly share code, notes, and snippets.

@dsdunn
Created August 12, 2018 21:31
Show Gist options
  • Save dsdunn/86af845ae13cfc2351d9002052f16d1a to your computer and use it in GitHub Desktop.
Save dsdunn/86af845ae13cfc2351d9002052f16d1a to your computer and use it in GitHub Desktop.
const isOverTen = (num) => {
return new Promise((resolve, reject) => {
if (num > 10) {
resolve(num + ' is greater than 10')
} else reject(num + ' is less than or equal to ten')
});
}
const makeCaps = (arr) => {
return new Promise((resolve, reject) => {
let newArr = arr.map(item => {
if (typeof item != 'string') {
reject('only strings!')
} else return item.toUpperCase()}
)
resolve(newArr)
})
}
const sort = (arr) => {
return new Promise((resolve, reject) => {
resolve(arr.sort());
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment