Async JS Codevolution
Why async How ? Tradional Methdo of Js setTimeout To Clear a timeout use It will ensure that greet function will not run after 2 sec duration Remember to clear the interval esle it will run forever 2 cont... funtion will run only after call stack is free CALLBACKS Rewriting the code as per their names Types of Call Back Sycnhronus Callback (Same as bove) Nothing to fancy about synchronus callback Async Callback Here, the magic is there so learn it ,revise it In eg 1 setTime out is hOF and greet() is callback funtion eg 2: addEventListener is HOF and the fn attaxched to event handler is the callback as it will only be excute after it isbeen clicked This becomes extremely unreadble so promises has been introduced Promise ' WEcan pass value to resolve and rejected if we want to add extra bit of info The value is automactially fetched and it can be accessed More details Bothe means same Howevver, 3. Chaining Pr...