Created
March 12, 2018 15:24
-
-
Save JoanClaret/25c4cfb8d183b1e79cc4371ab930b06f to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/kabijox
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
const suma = (number) => new Promise((resolve, reject) => setTimeout(() => resolve(number + number), 2000)) | |
suma(2).then((response)=> suma(response).then((response) => console.log(response))) | |
const foo = async (x) => { | |
const a = await suma(2); | |
const b = await suma(2); | |
return x + a + b; | |
} | |
foo(10).then(v => { | |
console.log(v); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const suma = (number) => new Promise((resolve, reject) => setTimeout(() => resolve(number + number), 2000)) | |
suma(2).then((response)=> suma(response).then((response) => console.log(response))) | |
const foo = async (x) => { | |
const a = await suma(2); | |
const b = await suma(2); | |
return x + a + b; | |
} | |
foo(10).then(v => { | |
console.log(v); | |
});</script></body> | |
</html> |
This file contains 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 suma = (number) => new Promise((resolve, reject) => setTimeout(() => resolve(number + number), 2000)) | |
suma(2).then((response)=> suma(response).then((response) => console.log(response))) | |
const foo = async (x) => { | |
const a = await suma(2); | |
const b = await suma(2); | |
return x + a + b; | |
} | |
foo(10).then(v => { | |
console.log(v); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment