JavaScript Promise in 100 Seconds
Key Takeaways
This video explains JavaScript Promises, a fundamental concept in asynchronous programming, using a ride-hailing app analogy and covering promise states, executor functions, and methods like then, catch, and finally.
Full Transcript
a promise represents a value that is unknown now that may become known in the future in other words in asynchronous value think of it like a ride hailing app when you request a ride the driver makes a promise to pick you up while you're waiting the ride is pending in the future if all goes according to plan the driver will resolve to pick you up then take you somewhere at which point your ride has been fulfilled but in some cases the driver might reject your ride in which case you'll need to catch one somewhere else either way the original request is now finally settled as a developer he might want to create a promise to represent an asynchronous value but more often than not you'll be consuming promises to use the result of an asynchronous operation in your code on the Left we're making promises on the right we're using them when constructed a promise starts off in a pending state it's your job to define a callback function called an executor that defines when to resolve or reject the promise this is where you would kick off your asynchronous work on the other side the consumer of the promise has called it's then method it's waiting for the asynchronous value to be fulfilled when that happens it will call this function with the value as its argument we fulfill the promise by calling resolve but there's always the possibility of an exception in that case we can reject the promise and send the error back down to the consumer which can use the catch method and an entirely different function for handling exceptions and if you just want to run some code no matter what you can use finally to handle both possibilities all of these methods return promises which means they can be chained together to handle multiple asynchronous operations in a row this has been JavaScript promises in 100 seconds thanks for watching and also make sure to follow my brand new Instagram account for even more content on this topic I will see you in the next one [Music]
Original Description
Learn JavaScript Promises in 100 seconds, then follow my new IG account for even more content https://www.instagram.com/fireship_dev/
Reference MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
#javascript #100SecondsOfCode
Upgrade to Fireship PRO at https://fireship.io/pro
Use code lORhwXd2 for 25% off your first payment.
My VS Code Theme
- Atom One Dark
- vscode-icons
- Fira Code Font
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Fireship · Fireship · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Angular 4 Development and Production Environments with Firebase
Fireship
OAuth with Angular and Firebase Tutorial
Fireship
Anonymous Authentication with Angular and Firebase - Lazy Registration
Fireship
Angular Router Guards for Firebase Users
Fireship
Angular Firebase CRUD App with NoSQL Database Tutorial
Fireship
Upload Files from Angular to Firebase Storage
Fireship
How to Deploy an Angular App to Firebase Hosting
Fireship
Sharing Data between Components in Angular
Fireship
Loading Spinners for Asynchronous Firebase Data
Fireship
Angular 4 Transactional Email with Google Firebase Cloud Functions
Fireship
Firebase Database Rules Tutorial
Fireship
Autocomplete Search with Angular4 and Firebase
Fireship
Reddit Inspired Upvoting System with Angular and Firebase NoSQL
Fireship
Angular Drag-and-Drop File Uploads to Firebase Storage
Fireship
Text Translation with Firebase Cloud Functions onWrite and Angular 4
Fireship
Custom Usernames with Firebase Authentication
Fireship
Twitter-Inspired Follow Unfollow Feature with Firebase and Angular 4
Fireship
Simple Pagination with Firebase and Angular 4
Fireship
How to Connect Firebase Users to their Data - 3 Methods
Fireship
Add Toast Message Notifications to your Angular App
Fireship
Facebook-Inspired Reactions System with Angular and Firebase
Fireship
Learn NgModule in Angular with Examples
Fireship
Lazy Loading Components in Angular 4
Fireship
Stripe Checkout Payments with Angular and Firebase - Part 1
Fireship
Process Stripe Payments with Firebase Cloud Functions - Part 2
Fireship
Selling Digital Content in Angular with Stripe Payments - Part 3
Fireship
Angular 4 Full Text Search with Algolia - Part 1
Fireship
Algolia with Firebase Cloud Functions - Part 2
Fireship
Firebase Phone Authentication in Angular 4
Fireship
Top 7 RxJS Concepts for Angular Developers
Fireship
Learn Angular Animations with 5 Examples
Fireship
Advanced Firebase Data Filtering (Multi-Property)
Fireship
Realtime Maps with Mapbox + Firebase + Angular
Fireship
Angular Reactive Forms with Firebase Database Backend
Fireship
Send Push Notifications in Angular with Firebase Cloud Messaging
Fireship
Top 7 Ways to Debug Angular 4 Apps
Fireship
Infinite Scroll with Angular and Firebase
Fireship
Use TypeScript with Firebase Cloud Functions
Fireship
Realtime Graphs and Charts with Plotly and Firebase
Fireship
Role-Based User Permissions in Firebase
Fireship
User Presence System in Realtime - Online, Offline, Away
Fireship
Location-based Queries with GeoFire and Angular Google Maps
Fireship
Angular ngrx Redux Quick Start Tutorial
Fireship
Angular Ngrx Effects with Firebase Database
Fireship
Progressive Web Apps with Angular
Fireship
Angular Ngrx with Firebase Google OAuth User Authentication
Fireship
RxJS Quick Start with Practical Examples
Fireship
Send SMS Text Messages with Twilio and Firebase
Fireship
Firebase Database Performance Profiling
Fireship
Native Desktop Apps with Angular and Electron
Fireship
Subscription Payments with Stripe, Angular, and Firebase
Fireship
Firestore with AngularFire5 Quick Start Tutorial
Fireship
Angular HTTP Client Quick Start Tutorial
Fireship
Google Sign-In with Firestore Custom User Data
Fireship
Star Review System from Scratch with Firestore + Angular
Fireship
Angular Chatbot with Dialogflow (API.ai)
Fireship
Learn @ngrx/entity and Feature Modules
Fireship
Infinite Scroll Pagination with Firestore
Fireship
Faster Firestore via Data Aggregation
Fireship
Contentful - CMS for Angular Progressive Web Apps
Fireship
More on: AI Pair Programming
View skill →Related Reads
📰
📰
📰
📰
Day 4 of 100 Days of GenAI for DevOps🚀
Dev.to AI
Local LLMs for agentic coding: a real-world viability report
Dev.to AI
Beyond Replication: Theo Browne on AI's 'Skeuomorphic Phase' and the Future of Development
Dev.to AI
Rust and Artificial Intelligence: The Rust Foundation's Position
Hacker News
🎓
Tutor Explanation
DeepCamp AI