Bifalgorithm post
Async await is a nicer, cleaner way of handling promises. Okay, so what does that mean? When you have a function that returns a promise, you can handle the promise using a then and a catch block. Or it would be much nicer if you could just assign the return value to a variable as if it was synchronous. Well, you can. The trick is you have to tell JavaScript that this is an async operation. Otherwise, JavaScript runs top to bottom. It will just move on and your result variable will be a pending promise incomplete, fugazi a foo gaze It's not what you want. So how do I tell JavaScript to slow the down? You put a weight in front of the function invocation and the invocation itself has to be inside a function that's marked async You can use a weight without async, but hold that thought for a second This tells JavaScript to treat this function as if it has async stuff happening inside It's the the difference between this simple straightforward looking code and this sh*t show. And we can handle errors using TryCatch with three distinct benefits which I explained in the full video linked below. Plus how to use await without async.
Async await is a nicer, cleaner way of handling promises. Okay, so what does that mean? When you have a function that returns a promise, you can handle the pro…
Ideas in this flowchart
- Async Await
- Handling Promises
- Promise Handling Methods
- Then and Catch
- Async Await Method
- Assign Return Value
- Async Operation Requirement
- Await Keyword
- Async Function Requirement
- Try-Catch Error Handling
- Benefits of Try-Catch
- Using Await without Async