Last active
February 23, 2020 08:04
-
-
Save DmitryMasley/1f16f7327c62daf411ef46d29cdd17cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const promise = new Promise((resolve) => resolve("John Smith")); | |
// what is the difference between these versions? | |
// is there incorrect syntax? | |
//1 | |
promise | |
.then((name) => { | |
return `Hello, ${name}` | |
}) | |
.then((message) => console.log(message)); | |
//2 | |
promise | |
.then(async (name) => { | |
return `Hello, ${name}`; | |
}) | |
.then((message) => console.log(message)); | |
//3 | |
promise | |
.then((name) => { | |
return Promise.resolve(`Hello, ${name}`); | |
}) | |
.then((message) => console.log(message)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment