Back

Shubham

Fearlessย โ€ขย 6m

Day 10/21 โ€“ JavaScript: Callback, Promise & Async/Await Today I learned how JavaScript handles asynchronous tasks like API calls, file loading, or timers. โšก ๐Ÿ”น Callback โ€“ a function passed into another function function fetchData(cb) { setTimeout(() => cb("Data received!"), 1000); } fetchData(msg => console.log(msg)); ๐Ÿ”น Promise โ€“ cleaner way to handle async let data = new Promise((res) => { setTimeout(() => res("Promise resolved!"), 1000); }); data.then(msg => console.log(msg)); ๐Ÿ”น Async/Await โ€“ modern & readable syntax async function getData() { let result = await data; console.log(result); } getData(); ๐Ÿ‘‰ Callback = nesting ๐Ÿ‘‰ Promise = chaining ๐Ÿ‘‰ Async/Await = clean & readable This is the heart of modern JS development ๐Ÿš€ #21DayJavaScript #JavaScript #WebDevelopment #CodingJourney #LearnInPublic

Reply
1

More like this

Recommendations from Medial

Shubham

Fearlessย โ€ขย 5m

Day 11/21 โ€“ JavaScript API Calls ๐ŸŒ Today I explored how to fetch data from APIs in JavaScript using async/await. Copy code Javascript async function getUsers() { try { let response = await fetch("https://jsonplaceholder.typicode.com/users");

See More
Reply
3

Sagar gupta

Full-time Freelancer...ย โ€ขย 1y

Most Javascript Questions Asked in Interview | PART 2 1. What is difference between a for loop and for Each loop Ans: A for loop is traditional loop that uses a counter variable to iterate over an array. ForEach loop is a method that iterate over a

See More
Reply
3
10

Inayat Hasan

Software engineerย โ€ขย 1y

[This post has been deleted by the creator]

Reply
1
3

Shubham

Fearlessย โ€ขย 6m

๐Ÿš€ Day 2 of 21 โ€“ JavaScript Learning Journey Topic: Operations & Conditional Statements ๐Ÿ”น Operations in JavaScript Arithmetic: + - * / % Assignment: = += -= Comparison: == === != > < >= <= Logical: && || ! ๐Ÿ”น Conditional Statements // if sta

See More
1 Reply
1
16

Shubham

Fearlessย โ€ขย 6m

Day 05/21 โ€“ JavaScript Functions & Methods Today I explored one of the most powerful concepts in JavaScript: Functions & Methods. ๐Ÿš€ ๐Ÿ”น Functions are blocks of code designed to perform a specific task. They help in reusability and make code cleaner

See More
Reply
1

Shubham

Fearlessย โ€ขย 6m

Day 09/21 โ€“ JavaScript Classes & Objects Today I explored Classes & Objects in JavaScript โ€“ the building blocks of Object-Oriented Programming (OOP). ๐Ÿš€ ๐Ÿ”น Objects = collections of data & methods ๐Ÿ”น Classes = blueprints to create objects Example:

See More
Reply
8

Shubham

Fearlessย โ€ขย 6m

๐Ÿš€ Day 3/21 โ€“ My JavaScript Learning Journey Today I explored two core concepts: Loops & Strings. ๐Ÿ”น Loops in JavaScript for โ†’ classic loop with index. while โ†’ runs until a condition is true. do...while โ†’ executes at least once. for...of โ†’ best

See More
Reply
6

Download the medial app to read full posts, comements and news.