🆖 Karan Oza Profile picture
Sep 20, 2020 9 tweets 3 min read Read on X
🧵Promises In JavaScript🧵

✅Informative Thread with an Examples

#100DaysOfCode #CodeNewbie #javascript
" I promise to do this whenever that is true. If it isn't true, then I won't."

This is a simple illustration of JavaScript Promises. Sounds like an IF statement? We’ll soon see a huge difference.
- A promise is used to handle the asynchronous result of an operation.

- JavaScript is designed to not wait for an asynchrnous block of code to completely execute before other synchronous parts of the code can run.
For instance, when making API requests we have no idea if servers are offline or online & how long it takes to process server request. With Promises, we can defer execution of code until async request is completed. This way, other operations can keep running without interruption
Promises have three states:

- Pending: This is the initial state of the Promise before an operation begins

- Fulfilled: This means the specified operation was completed

- Rejected: The operation did not complete; an error value is usually thrown Image
Lets create promise,

If weather is true, resolve the promise returning the data dateDetails, else return an error object with data Bad weather, so no Date. Image
Using Promises

Using a promise that has been created is relatively straightforward; we chain .then() and .catch() to our Promise like so: Image
Since the weather value is true, we call mydate() and our console logs read:

We are going on a date!
{
name: 'Cubana Restaurant',
location: '55th Street'
table: 5
}
They come in handy a lot when making API requests and event handling. You can learn more about using promises is on below link :

developer.mozilla.org/en-US/docs/Web…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with 🆖 Karan Oza

🆖 Karan Oza Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @OzaKaran

Oct 10, 2020
🧵How To Find A Job 🧵

✅5 Important Steps & Guideline

#100DaysOfCode #CodeNewbie
1. Online Job Searching Platforms

1. Indeed: Best Overall
2. AngelList: Best for Startup Jobs
3. LinkedIn: Best for Connecting Directly With Recruiters
4. LinkUp: Best for Up-to-Date Listings
5. Scouted: Best for Recent College Graduates
6. Snagajob: Best for Hourly Jobs
7. Monster: Runner-Up, Best Overall
8. Glassdoor: Best for Employer Insights
9. FlexJobs: for Remote Jobs
10. The Ladders: Best for Experienced Managers
11. Google for Jobs : job search feature, making it possible for job seekers to search for positions straight through Google
Read 15 tweets
Oct 1, 2020
🧵Top JavaScript Interview Questions🧵

⚡️Questions and Answers :

#100DaysOfCode #CodeNewbie #javascript
Q1 . What is JavaScript?

JavaScript is a text-based programming language used both on the client-side and server-side that allows you to make web pages interactive. The general-purpose core of the language has been embedded in Netscape and other web browsers.
Q2. Is JavaScript a case-sensitive language?

Yes, JavaScript is a case sensitive language. The language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
Read 27 tweets
Sep 29, 2020
🔗Chain of Motivation and Appreciation

🌈 You all are doing amazing work.
Claps for your motivation & support 👏👏👏

📝 Mention your friends, mentor or accounts from whom you inspired & want to appreciate them 👏🤗🙏

#100DaysOfCode #CodeNewbie
@sandhya_subram
@RitikaAgrawal08
@pritkalariya
@SeemaSaharan5
@styleDevNerd
@Deepak_python
@TracyCss
@HTMLmom

Thanks for always inspiring this Dev Community 🙏👏 keep doing amazing.
Read 5 tweets
Sep 29, 2020
🧵JavaScript Frameworks to Learn🧵

⭐️Front-End, Back-End & Testing

#100DaysOfCode #CodeNewbie #javascript
According to stackoverflow’s survey 2020, JavaScript is the most commonly used language for the 8th year straight with 67.7% people opting for it. The major reason for its popularity is the fact that its versatile & can be used for both frontend & backend as well as for testing.
Front End JavaScript framework

1. React JS
2. Angular
3. Vue Js
4. Ember JS
5. Preact JS
6. Svelte JS
7. Jquery
8. Backbone JS
Read 5 tweets
Sep 28, 2020
🧵Web Development Project Ideas For CodeNewBies🧵

1. One-page layout
2. Login authentication
3. Product landing page
4. Giphy with a unique API
5. JavaScript Quiz game
6. To-do list
7. SEO-friendly website

#100DaysOfCode #CodeNewbie
8. JavaScript drawing
9. Reminder app
10. Google home page Clone
11. Tribute page
12. Survey form
13. Exit plugin
14. Weather app
15. Social share buttons
16. Toast notifications
17. AJAX-style login
18. Word counter
19. Countdown timer
20. Modal pop-ups
21. Address book
22. The Movies Dashboard
23. Tic Tac Toe Game
24. E- commerce Site
25. Color picker jumbtron
Read 4 tweets
Sep 24, 2020
🧵Asynchronous JavaScript & Callback🧵

⚡️Informative thread with examples

#100DaysOfCode #CodeNewbie #javascript
Synchronous :

- Synchronous operations in JavaScript entails having each step of an operation waits for the previous step to execute completely.

- This means no matter how long a previous process takes, subsequent process won't kick off until the former is completed. Image
Asynchronous :

- Asynchronous operations, on the other hand, defers operations.

- Any process that takes a lot of time to process is usually run alongside other synchronous operation and completes in the future. Image
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(