I've found this sample snippets in this article :
<script>
async function get_data() { // async function
await $.get('https://url.com/one')
await $.get('https://url.com/two')
let res = await $.get('https://url.com/three')
console.log(res)
}
</script>
Which is the promised version of :
<script>
function get_data() {
$.get('https://url.com/one', () => {
$.get('https://url.com/two', () => {
$.get('https://url.com/three', (res) => {
console.log(res)
})
})
})
}
</script>
My question being, in the promised version, can we turn
await $.get('https://url.com/one')
into await $.get('https://url.com/one')
as it is the first promise?If yes, why would either one of both be considered as best practice?
Thank you in advance