JavaScript Promises In 10 Minutes - #Part2 JavaScript ES6 Darija | الوعود في جافاسكريبت الدارجة
#jspromise #jspromise #jspromisetutorial #jspromisesvscallbacks #jspromiseexplained ES6 came with many new features, but one of the best features was the official introduction of Promises. Promises allow you to write clean non-callback-centric code without ever having to worry about callback hell. Even if you never write your own promise, knowing how they work is incredibly important, since many newer parts of the JavaScript API use promises instead of callbacks. Check out the full video to learn how to define and use promises. javascript promises = الوعد ------------------- fn() = callback function new Promise(function(resolve, reject) {}) const p = new Promise((resolve, reject) = { resolve() reject() }) resolve = fullfield = then(fn()) reject = rejected = catch(fn()) ---------------------------- p.then(fn()).catch(fn()) p.catch(fn()) --------------------- then and catch anonymous function function expression arrow function
#jspromise #jspromise #jspromisetutorial #jspromisesvscallbacks #jspromiseexplained ES6 came with many new features, but one of the best features was the official introduction of Promises. Promises allow you to write clean non-callback-centric code without ever having to worry about callback hell. Even if you never write your own promise, knowing how they work is incredibly important, since many newer parts of the JavaScript API use promises instead of callbacks. Check out the full video to learn how to define and use promises. javascript promises = الوعد ------------------- fn() = callback function new Promise(function(resolve, reject) {}) const p = new Promise((resolve, reject) = { resolve() reject() }) resolve = fullfield = then(fn()) reject = rejected = catch(fn()) ---------------------------- p.then(fn()).catch(fn()) p.catch(fn()) --------------------- then and catch anonymous function function expression arrow function