Introduction to Callbacks | JavaScript Tutorial in Hindi #52

preview_player
Показать описание

python, C, C++, Java, JavaScript and Other Cheetsheets [++]:

►Learn in One Video[++]:

►Complete course [playlist]:

Follow Me On Social Media
Comment "#HarryBhai" if you read this 😉😉
Рекомендации по теме
Комментарии
Автор

Thode din ka break le liya tha yaar videos se. JS series is back now!

CodeWithHarry
Автор

For those who need more clearance can look at the below callback function

function add(a, b){
return a+b;
}

function divide(a, b) {
return a/b;
}


function calculate(x, y, operation) {
return operation(x, y);
}


console.log(calculate(10, 5, add));

console.log(calculate(10, 5, divide));

Thanks!!

soothingmusicforrelaxation
Автор

I gave two days to this video and watched it 3-4 times then only I got clear. Guys it's ok if you don't get it in the first try. Do watch some other videos too and come back to this one. It'll help

saugatnepal
Автор

This video was at another level as compared to previous ones. If you notice the code carefully, you get to see how callbacks are actually implemented inside the function. Though we use such functions in js a lot, but don't know what is happening in function definition.
At least I got this doubt once....

umarjanbhat
Автор

I feel this is one of the toughest videos in this series as of now ! need to watch at least 3-4 times to understand

Gourav-
Автор

Just one word THANK YOU BHAI....only I know my emotions ❤️❤️❤️

sahilpanchbhaiya
Автор

20:00 I was stuck in this video for two days and couldn't understand what's going on with async and error handling. But fortunately I didn't leave and now it's crystal clear to me. 😍😍

prithwishhati
Автор

Me boht tenshion me a giya meny smja ke harry bhi ny y Course quite kr diya but Finally I'm very happy @codewithharry😊😊😊😘😘😘😍

liaqatali
Автор

I watched this video one time, and then I understood. Hats off to Harry Bhai. Thank you so much for making such quality content!

THGisOPxd
Автор

It got me whole day to understand this video . Tip - copy the code in the replit then ask the replit AI to answer your all questions or just ask to explain the whole code

Recap_express
Автор

function loadScript(src){
let script =
script.src = src;
script.onload = function(){
console.log("Loaded script with SRC: " + src)
}



DRY RUN -- > This JavaScript function loadScript dynamically loads an external script into the HTML document. Here's a detailed breakdown of what each part does:

1. function loadScript(src)
The function takes one argument, src, which is the URL (or path) of the script to be loaded.
2. let script =
This line creates a new <script> HTML element. In JavaScript, document.createElement() is used to create a new DOM element, in this case, a <script> tag.
3. script.src = src;
The src attribute of the <script> element is set to the URL provided as an argument (src). This specifies the external JavaScript file to be loaded.
4. script.onload = function(){...}
The onload event handler is set for the script element. Once the script has finished loading, the code inside this function will be executed. In this case, it logs a message to the console:
js

console.log("Loaded script with SRC: " + src)
This ensures that the message appears only after the script is fully loaded.
5.
This line appends the newly created <script> element to the body of the HTML document. Once added to the document, the browser will fetch and execute the external JavaScript file specified by the src.
Summary:
The loadScript function dynamically adds a <script> tag to the document's body. It sets the source of the script to the provided URL (src), and once the script is fully loaded, it logs a message to the console confirming the successful load.

This pattern is commonly used for dynamically loading external scripts, such as third-party libraries or additional code modules, without needing to hard-code them into the HTML file.

(No need to thanks me..thanks ChatGpt ( Keep hustling )

ankurddank_afmishra
Автор

Thanks harry for adding advanced topics in this list

aashishbhawsar
Автор

Thank you bhaiya for resuming the course. The course is really helpful.

tanya_
Автор

I'm about to finish web developement
(Html/CSS/JAVA SCRIPT),
AND
Also waiting for more good videos.
THANKS!!!
This is for u ❣️❣️❣️❣️😌😀👍

YDJUNIOUR
Автор

While those who are trying to understand JS, you are supposed to understand and explore by yourself with the help of documentation, Harry has made it more easier and you still complaining for getting it tough. Watch this video multiple times, write down these codes in paper and try to trace the flow of code. It will be so simple and you will learn so smoothly

hoodleforward
Автор

What I noticed is that Harry Bhai says koi badi baat nahi hai even to some complex topics to motivate you so that you don't give up thinking it's a difficult one. 💕💕

saugatnepal
Автор

6:34 Harry bhai ki smile yar😍😍😍love hai😍😍love from pakistan💖

Craze
Автор

Thanks harry bhai....Finally Javascript course is back now!..❤️❤️❤️

abdur_
Автор

are bhaii ye replit ka auto mat use kro yrr code likhte waqt samjhate ho toh achha samjhta hai bhaii...

rahulwagh
Автор

when we load script.src = src, then <script></script> becomes <script src="blablabla"> </script>, this is what onload refers, that blablabla can be the another js file in which you're not coding these stuffs, and if you provide correct js file in script or if you provide the correct js file that you have in the same folder then it is onload and if there doesn't exist a js file instead then it is onerror, feel free for any doubts, many may find this callback event overwhelming

hoodleforward