Skip to content

Instantly share code, notes, and snippets.

@svngoku
Created December 26, 2018 23:40
Show Gist options
  • Select an option

  • Save svngoku/3b10e83c3c938182884e3756d3ffd222 to your computer and use it in GitHub Desktop.

Select an option

Save svngoku/3b10e83c3c938182884e3756d3ffd222 to your computer and use it in GitHub Desktop.
Promise created by svngoku - https://repl.it/@svngoku/Promise
/* Promise : This code print the first and the second value */
const p = Promise.resolve('hello')
p.then(val => {
console.log(val)
return `${val} world`
}).then(newVal => {
console.log(newVal)
});
@svngoku

svngoku commented Dec 26, 2018

Copy link
Copy Markdown
Author

return Hello in the first printing and Hello World after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment