Javascript's async function can also return values
We all know how to use `then` in Javascript, but not all of us know how to create an async function that others can use with `then`. Look the following examples carefully:
In Javascript:
```
async function return_a_number() {
// do some operations before you return anything
return 520
}
async function use_another_async_function() {
return_a_number().then((number) => {
// we can use the result of previous function in a new async function
console.log(number)
})
}
use_another_async_function()
```
If you are using `axios`, remember to return `axios.post()` as well, because it's also a promise.
If you are using `axios`, remember to return `axios.post()` as well, because it's also a promise.
In Python:
```
async def return_a_number():
return 520
async def use_another_async_function() {
number = await return_a_number()
print(number)
}
use_another_async_function()
```