This is the only tutorial I have ever watched where i did not felt like my head was going to explode trying to decipher all the technical jargon. You explain so well if words people can actually understand. Well done champion, keep up the good work!
This was brilliantly communicated. Like others have said, i felt like i am at a sea side cafe, cool breeze blowing! Hands down one of the best tutorial about any topic.
Awesome explanation! I could really fix the concept in my mind. One common problem when learning programming is that you assume you understand a concept, while it can has a quite different meaning or purpose. Thanks, man!
This time this is a really good example to illustrate a JS feature ! Not understood everything at first glance but nothing looks at first confusing ...and furthermore looks like a good JS real life donuts to loop on until I got it !
Binge watching the JS playlist trying to learn the advanced concepts and uptil this point, I am glad I started it. I am learning so much. Thanks for the vids man :D
Yes please. Share them with everyone. My goal is to help as many people as possible understand how to program. So, the more subscribers I get the more people I can help.
I went ahead and shared some on different facebook groups. Given the quality of your tutorials, I believe they should be much more popular. I believe, It's just these other channels play the search results and naming the video game. you tube works like the google search engine I believe when it comes to SEO of videos; the other issue holding back the numbers are the low view counts. For instance, when I do a video search, I first look at the results for someone I know and like, then I look at the number of views if I dont know anyone, preferring of course videos with a greater number of views. But as I've learned when I found your channel the theory of believing the best videos are the ones with the highest views is debunked now. How I wish I would have found your channel long ago my learning curve could have been shorter. Fortunately, I only began learning in June 2016. Welp, I'll help you where I can Steve. You give to us, so the least can can do is to give back to you. Thank you!
Thank you very much David. It is very much appreciated. You are right about the number of views thing though. It is hard to get past that. I'm slowly growing my channel. Last summer I was averaging about 10-20 views per day. Now I'm averaging 700+ per day. I would love to have more subscribers though. That would mean immediate viewing of a lot more videos.
You are clever enough to simulate the geolocation and not to do the actual ones. Any way, great stuff to learn as always, after getting used to your quality, it is hard to go elsewhere. Thank you.
Hey sir, good content to be learned. One thing I want to ask, the callback call() method is always require an object to placed at first of the parameter, and other argument for the rest. In your case (good.call(app.geolocation, pos)); Can we change (app.geolocation) to any object we want inside good.call() to just fill the requirement of the object needed for call() method ? Thank you, glad to hear soon from you sir :)
When you use call or bind or apply the first argument will represent 'this' inside the function. You can put anything you want there, even null. Note- the this argument gets ignored inside arrow functions
When we specify the context the function should be called in, aren't we supposed to give it an object as first parameter because you gave a function as the first parameter in good.call() and bad.call()
In my code, good and bad are direct references to two functions. They do not have an additional context. The actual functions are `success` and `fail`. We are really just providing named containers to hold the references to those two functions. When we call them, we are calling `success` and `fail`, which are both in the global context.
Thank you for your video, I can see you are explaining things very well. I understand this makes total sense and I have no doubt the video is clear and straight to the point. However my brain is just exploding (I guess I am not experienced enough to understand the things you're saying) and I just can't wrap my head around it! For example, why do you have (success, fail) and (good, bad) , why don't you just keep them all the same? Why aren't the pairs always success and fail
They are just names. You can call them whatever you like. - (Fred and Charlie) or (ftw and wtf) or (yay and boo). Functions are just like variables you can call them pretty much whatever you like. Just choose names that make sense for what you are doing. Keep practicing. It will come. Everyone has lightbulb moments at different times.
@@SteveGriffith-Prof3ssorSt3v3 Thank you for the swift reply and for the explanation! I just have one more question - the bit after "else" when you write "good.call(app.geolocation, pos)", how does JavaScript know that the second parameter "pos" is associated with the first (and only) argument in your "success" function "position"? Why isn't it associating "app.geolocation" with "position" instead?
@@kalinsavchev7933 The parameters that get passed to the callback function are defined by which method you call. eg: someArray.forEach( function(item, index, arr) { } ); navigator.geolocation.getCurrentPosition( function( position ) { }, function( err ) { } ); IF you are calling the array forEach method then there will always be one callback function with three things passed and they will always be the same three things in the same order. IF you are calling geolocation's getCurrentPosition then there are two callback functions. The first callback will be the success one and it will always be passed a position object. You call the variables whatever you want. Each callback function will do something specific and be given specific parameters.
@@SteveGriffith-Prof3ssorSt3v3 Thank you so much! I had to read it a few times but now it makes sense! Thank you so much for your time to write all this. Gained a subscriber!
the same logic could easily be written in 1 function. The reason why we are using callbacks is because we take into account the time it takes to get the response from the Geolocation API correct? Good Lesson ty!
That is correct about the callbacks. However, there are three functions regardless of how you write them. The one function that makes the geolocation call and then the two callback functions. It is easier for someone else to read, edit or debug if you use a named function and don't use as many nested functions.
One question I had was how the 'pos' variable was accessed by the .call method on line 40 given the fact that is the 'pos' variable has a let keyword that limits it scope to within the try statement block. Otherwise, great tutorial!
line 40 is still inside the try block. The if else blocks are inside the try but they have access to everything inside their parent, the try block. let a = 1; if( a > 0){ let b = 2; // we have access to a and b here for(let i=0; i
hey Steve, just some FYI in case you'd consider. I myself am interested in API's: meaning using the API's from social media and other things like Wikipedia. So any courses around that would be much appreciated for me. For instance, I can easily find JSON around but a good AJAX is difficult. Plus any suggestions as to what I need along with those, I'm sensing Node and Angular. Actually connecting to Wikipedia and pulling out some content would be an early '18 xmas present; for consideration. Thank you
Thanks for the note David. I have a list of nearly 300 videos I have planned. That list does include a number of APIs - both AJAX ones and HTML5 ones. I didn't have Wikipedia on the list so I will add it. I will try to move a few of those API videos up in the order for you. :)
Only one thing gets passed to the function. You could call the good function like this: let pos = { coords: { latitude: 50.5555, longitude: 50.5555 } } good( pos ); But the only time you would do something like that is if the geolocation getCurrentPosition call failed.
@@SteveGriffith-Prof3ssorSt3v3 Thank you for the fast reply Steve. I noticed after I wrote that, that your callback function only took one argument haha
This is the only tutorial I have ever watched where i did not felt like my head was going to explode trying to decipher all the technical jargon. You explain so well if words people can actually understand. Well done champion, keep up the good work!
This was brilliantly communicated. Like others have said, i felt like i am at a sea side cafe, cool breeze blowing!
Hands down one of the best tutorial about any topic.
As a software tester I struggled to understand callbacks - but within 5 mins of your video I *GOT* it. Thank you!!!
wonderful video, quickly made it clear what it can do
Awesome explanation! I could really fix the concept in my mind. One common problem when learning programming is that you assume you understand a concept, while it can has a quite different meaning or purpose. Thanks, man!
This time this is a really good example to illustrate a JS feature ! Not understood everything at first glance but nothing looks at first confusing ...and furthermore looks like a good JS real life donuts to loop on until I got it !
Binge watching the JS playlist trying to learn the advanced concepts and uptil this point, I am glad I started it. I am learning so much. Thanks for the vids man :D
may i share your tutorials....everywhere possible....you explain things in a way that human mind can understand....:)...really helping me......
Yes please. Share them with everyone. My goal is to help as many people as possible understand how to program. So, the more subscribers I get the more people I can help.
I went ahead and shared some on different facebook groups. Given the quality of your tutorials, I believe they should be much more popular. I believe, It's just these other channels play the search results and naming the video game. you tube works like the google search engine I believe when it comes to SEO of videos; the other issue holding back the numbers are the low view counts. For instance, when I do a video search, I first look at the results for someone I know and like, then I look at the number of views if I dont know anyone, preferring of course videos with a greater number of views. But as I've learned when I found your channel the theory of believing the best videos are the ones with the highest views is debunked now. How I wish I would have found your channel long ago my learning curve could have been shorter. Fortunately, I only began learning in June 2016. Welp, I'll help you where I can Steve. You give to us, so the least can can do is to give back to you. Thank you!
you are right.....
Thank you very much David. It is very much appreciated.
You are right about the number of views thing though. It is hard to get past that. I'm slowly growing my channel. Last summer I was averaging about 10-20 views per day. Now I'm averaging 700+ per day. I would love to have more subscribers though. That would mean immediate viewing of a lot more videos.
Another very cool tutorial !
You are clever enough to simulate the geolocation and not to do the actual ones. Any way, great stuff to learn as always, after getting used to your quality, it is hard to go elsewhere. Thank you.
Hey sir, good content to be learned. One thing I want to ask, the callback call() method is always require an object to placed at first of the parameter, and other argument for the rest. In your case (good.call(app.geolocation, pos)); Can we change (app.geolocation) to any object we want inside good.call() to just fill the requirement of the object needed for call() method ? Thank you, glad to hear soon from you sir :)
When you use call or bind or apply the first argument will represent 'this' inside the function. You can put anything you want there, even null.
Note- the this argument gets ignored inside arrow functions
@@SteveGriffith-Prof3ssorSt3v3 Thank you sir, so the function has several forms in written, well-noted sir
so at around 7:00, would app.geolocation be "this"? bc it's showing 3 arguments but success takes 2 parameters
Yes. with .call( ), .apply( ), and .bind( ) the first argument is "this". ruclips.net/video/uBdH0iB1VDM/видео.html
thanks man for all your videos
very nicely explained. Thank you!!!
5:10 I think it should be
pos.latitude = ( Math.random() * 180 ) - 90;
5:24 your previous code for longitude was correct
When we specify the context the function should be called in, aren't we supposed to give it an object as first parameter because you gave a function as the first parameter in good.call() and bad.call()
In my code, good and bad are direct references to two functions. They do not have an additional context. The actual functions are `success` and `fail`. We are really just providing named containers to hold the references to those two functions. When we call them, we are calling `success` and `fail`, which are both in the global context.
What a great explanation 👏👏👏
great explanation, thanks
very good explanation!
Thank you for your video, I can see you are explaining things very well. I understand this makes total sense and I have no doubt the video is clear and straight to the point. However my brain is just exploding (I guess I am not experienced enough to understand the things you're saying) and I just can't wrap my head around it!
For example, why do you have (success, fail) and (good, bad) , why don't you just keep them all the same? Why aren't the pairs always success and fail
They are just names. You can call them whatever you like. - (Fred and Charlie) or (ftw and wtf) or (yay and boo). Functions are just like variables you can call them pretty much whatever you like. Just choose names that make sense for what you are doing.
Keep practicing. It will come. Everyone has lightbulb moments at different times.
@@SteveGriffith-Prof3ssorSt3v3 Thank you for the swift reply and for the explanation!
I just have one more question - the bit after "else" when you write "good.call(app.geolocation, pos)", how does JavaScript know that the second parameter "pos" is associated with the first (and only) argument in your "success" function "position"? Why isn't it associating "app.geolocation" with "position" instead?
@@kalinsavchev7933 The parameters that get passed to the callback function are defined by which method you call. eg:
someArray.forEach( function(item, index, arr) { } );
navigator.geolocation.getCurrentPosition( function( position ) { }, function( err ) { } );
IF you are calling the array forEach method then there will always be one callback function with three things passed and they will always be the same three things in the same order.
IF you are calling geolocation's getCurrentPosition then there are two callback functions. The first callback will be the success one and it will always be passed a position object.
You call the variables whatever you want.
Each callback function will do something specific and be given specific parameters.
@@SteveGriffith-Prof3ssorSt3v3 Thank you so much! I had to read it a few times but now it makes sense! Thank you so much for your time to write all this. Gained a subscriber!
the same logic could easily be written in 1 function. The reason why we are using callbacks is because we take into account the time it takes to get the response from the Geolocation API correct? Good Lesson ty!
That is correct about the callbacks. However, there are three functions regardless of how you write them. The one function that makes the geolocation call and then the two callback functions. It is easier for someone else to read, edit or debug if you use a named function and don't use as many nested functions.
A great job is done. Thanks a lot.
great explanation
One question I had was how the 'pos' variable was accessed by the .call method on line 40 given the fact that is the 'pos' variable has a let keyword that limits it scope to within the try statement block. Otherwise, great tutorial!
line 40 is still inside the try block. The if else blocks are inside the try but they have access to everything inside their parent, the try block.
let a = 1;
if( a > 0){
let b = 2; // we have access to a and b here
for(let i=0; i
Great video, thanks.
hey Steve, just some FYI in case you'd consider. I myself am interested in API's: meaning using the API's from social media and other things like Wikipedia. So any courses around that would be much appreciated for me. For instance, I can easily find JSON around but a good AJAX is difficult. Plus any suggestions as to what I need along with those, I'm sensing Node and Angular. Actually connecting to Wikipedia and pulling out some content would be an early '18 xmas present; for consideration. Thank you
Thanks for the note David. I have a list of nearly 300 videos I have planned. That list does include a number of APIs - both AJAX ones and HTML5 ones. I didn't have Wikipedia on the list so I will add it. I will try to move a few of those API videos up in the order for you. :)
Thank you Steve!
Could you call the good function like this... ?
good(app.geolocation, pos);
Only one thing gets passed to the function. You could call the good function like this:
let pos = {
coords: {
latitude: 50.5555,
longitude: 50.5555
}
}
good( pos );
But the only time you would do something like that is if the geolocation getCurrentPosition call failed.
@@SteveGriffith-Prof3ssorSt3v3 Thank you for the fast reply Steve. I noticed after I wrote that, that your callback function only took one argument haha
Might be nice to change your title to specify the language used. Was looking for Matlab callback and got yours...
The Javascript logo is in the thumbnail image. 90% of my channel is about Javascript so I don't add Javascript in all the titles.
your example too complicated