I wish we could dine together! We could talk about how to dominate the world with javascript!
@konstantinkkk8397
5 жыл бұрын
you have created asyncFunction() but why you do NOT show the content of it? I have not understood this lesson from the beginning :(
@AllThingsJavaScript
5 жыл бұрын
Is your question asking why I created the asyncFunction? Or is there something else you would like me to explain better?
@konstantinkkk8397
5 жыл бұрын
@@AllThingsJavaScript when you type in asyncFunction () in browser it show Promise. What the content inside of asynkFunction ()?
@AllThingsJavaScript
5 жыл бұрын
asyncFunction just returns a promise. That is all. It sets a short timer and then returns a promise. If you haven't yet it may help to watch all the movies in the playlist: kzitem.info/door/PLTo9PCskHpbHIDnzl8tRYldSCSQaFgAHd
@dheerajnaik6467
4 жыл бұрын
Hi Konstantin . . To answer your question , the tutor has set up those promises.
@mattjak7834
5 жыл бұрын
Thank you. It's a pleasure to watch such detailed and simplified for understanding materials. Thank you so much for your work.
@RameenFallschirmjager
4 жыл бұрын
This concept ain't so easy. It takes multiple iterations to master. I watch your videos more than once. This one is almost excellent!
@mage9264
6 жыл бұрын
Top teaching skills and resources.
@zameeebasha
6 жыл бұрын
Excellent explaination Steve, you did not mention that promise.then() / catch() methods return a promise in turn, if I am not wrong.
@AllThingsJavaScript
6 жыл бұрын
You are correct! then and catch both return promises.
@nikhilkohli3064
6 жыл бұрын
Hi Steve, can you please post the contents of asyncfunc() and asyncfunc2() ?
@AllThingsJavaScript
6 жыл бұрын
I don't remember the exact function but it was simply doing a settimeout I believe. Something like this: let asyncFunction = function() { return new Promise(function(resolve, reject) { setTimeout(function() { resolve(asyncFunction has been resolved"); }, 5000) }); };
@konstantinkkk8397
5 жыл бұрын
@@AllThingsJavaScript finally I find it!!!! It was very important!!!!
@ayasswain
4 жыл бұрын
Wonderful tutorial on promises. Where is the code of asyncFunction( ) ? I mean the body of asyncFunction( ). Your voice is clear and the way you explain with example code is too good. The best teacher on javascript award goes to you :-) .
@AllThingsJavaScript
4 жыл бұрын
Thanks for the positive feedback! The asyncFunction is in a separate JS file attached to the same HTML page. I just separated it to simulate a function that might not be a part of your own code.
@ahmedr.
2 жыл бұрын
Bravo! Before I watched your video I was preconditioned that promise in Js is hard to grasp and understand. I got it after 20 min .. amazing content :)
@AllThingsJavaScript
2 жыл бұрын
Glad it was helpful!
@sameershrestha7818
4 жыл бұрын
At 23:28, what happens when there is an error in the second .then? Won't the following .then get executed? It seems like the control flow moves to .catch whenever an Error is created. Is it so? And .then before .catch doesn't returns a promise, how can it work at all?
@AllThingsJavaScript
4 жыл бұрын
Yes, if there is an error, it jumps to .catch and executes whatever is in .catch. So you need to make sure you include in .catch what you want to happen if there is an error. If you need to address errors individual, pass two functions to each .then.
@carlosfernandez6470
6 жыл бұрын
Nice explanation thank you so much.👍👍
@amguruprasath8037
5 жыл бұрын
Don of javascript == Sir, Steven Hancock.
@alexanderalancahutay4821
6 жыл бұрын
I really understand what a PROMISE really is because of you. Simple explanation thank you so much..
@AllThingsJavaScript
6 жыл бұрын
Thanks for the feedback! That helps me continue doing this.
@vont8424
3 жыл бұрын
for beginner, it's tough to understand the JS promises concept from this video. I only managed to get little understanding from this video.
@AllThingsJavaScript
3 жыл бұрын
As a beginner I wouldn't suggest learning promises from the start. I would recommend starting with the basics first. Perhaps a book or a course to get the basics down and then you can add to it.
@AllThingsJavaScript
3 жыл бұрын
If you are interested in my getting started course let me know. I'm not trying to sell this to you, I just think you would avoid a lot of frustration by learning the basics first. Good Luck! Stick with it!
@sameershrestha7818
4 жыл бұрын
Does console.log(def) at 21:33 need to be asynchronous?
@AllThingsJavaScript
4 жыл бұрын
Thanks for the question. It is asynchronous because it is in response to a promise, in the then statement.
@suemendez5674
5 жыл бұрын
Promises kept, thanks for the lesson, have a good day.
@Pareshbpatel
3 жыл бұрын
2021-09-20}
@sarveshsridhar4465
4 жыл бұрын
getting an error, async function is not defined....help!
@AllThingsJavaScript
4 жыл бұрын
Can you post code? If you are trying to use the same code as the tutorial, remember I defined an async function in a different JS file.
@sarveshsridhar4465
4 жыл бұрын
@@AllThingsJavaScript Sorry, I missed the function defined in the other JS file
@MrBenjjj6
6 жыл бұрын
Thank you!
@MeAsMeButMe
4 жыл бұрын
Dry-hole? :| Amazing video but that totally distracted me! xD
@flifluflofli
4 жыл бұрын
Can not believe from all my classes it the course where i get the closest of understanding it but hahah still the logic escape me terrible hey lol I will get it :)
@Pixie2678
4 жыл бұрын
I nearly gave up on Promises until I watched this video. Thank You so much
@AllThingsJavaScript
4 жыл бұрын
Glad I could help!
@germanduterte7110
4 жыл бұрын
Thank you for the deep explanation and simple example of what is promises in JavaScript
@PixelTB
3 жыл бұрын
Thank you for explaining it well. But I just have one question, does the .then functions itself returns a promise? Because you chained the .catch function to the .then function.
@AllThingsJavaScript
3 жыл бұрын
The then method doesn't return a promise, but may contain something that returns a promise.
@fanuel2198
4 жыл бұрын
Thanks a lot! This was much easier for me to understand compared to other videos I watched
@cjmarchi
5 жыл бұрын
Great! One thing that I find odd is..where is the asyncFunction () and asyncFunction2 () declarations? BTW, I love all your tutorials, please keep up the good work!
@AllThingsJavaScript
5 жыл бұрын
They are in a separate JS file.
@Pixie2678
4 жыл бұрын
@@AllThingsJavaScript That confused me as well
@anishkc1831
4 жыл бұрын
@@AllThingsJavaScript what's inside asyncFunction () function ? I am curious to know about the promises codes written inside the function .
@AllThingsJavaScript
4 жыл бұрын
@@anishkc1831 It just has a setTimeout is all. It looks something like this: let asyncFunction = function() { return new Promise(function(resolve, reject) { setTimeout(function() { resolve("asyncFunction has resolved."); }, 4000); }); };
@anishkc1831
4 жыл бұрын
@@AllThingsJavaScript thank you for a great tutorials bundle with depth knowledge
@seebugaud7243
6 жыл бұрын
Hello sir, Please tell me what is array-like object and how do create own array-like object? Am new in JavaScript
@AllThingsJavaScript
6 жыл бұрын
An array like object is simply an object that has a length property and then some indexed properties. So it has features of an Array, but was not created with the array literal ([]) or array constructor (new Array()). I'm not sure why you would want to create one, just create an array. However, sometimes these are created for you. For example, a node list (when you select HTML nodes) and the arguments of a function are array like. Usually we convert array like objects to arrays in order to work with them. Here is a tutorial: kzitem.info/news/bejne/wqyGr4x3n6abZWk
@mukurajpoot6550
5 жыл бұрын
Sir i am not able to understand ..a function that returns promise which converts the given array of string into uppercase and returns the result after n seconds, where n is the length of input array.
@AllThingsJavaScript
5 жыл бұрын
Which part are you having difficulty with? Have you viewed the entire playlist on promises?
@michelcmorel
4 жыл бұрын
Great work. Thank you very much👍
@someoneoutthere1866
3 жыл бұрын
very well structured video ;)
@chrislopezzz
5 жыл бұрын
Beautiful teaching .... well explained!
@vinayn9110
5 жыл бұрын
The concept is easy, the syntax is confusing !! in JavaScipt so many brackets etc..etc... and all tutorials assume you known the syntax frustrating !!!
@AllThingsJavaScript
5 жыл бұрын
Which syntax elements are confusing? We can help clarify it.
@vinayn9110
5 жыл бұрын
@@AllThingsJavaScript anonymous functions that have no name such as function(val) , is that a self evoking function?
@AllThingsJavaScript
5 жыл бұрын
@@vinayn9110 This is really considered a callback. I've got multiple tutorials on callbacks you may want to look at. This is a declared functions that is passed into another function; in this case the then method of a promise. The then method is then responsible for invoking that function. Callbacks can be a bit confusing, but are vary powerful. Here are links to a couple of tutorials: kzitem.info/news/bejne/r5erk517fpl2ooI and kzitem.info/news/bejne/1Xig3IuQp2uXqag
@vinayn9110
5 жыл бұрын
@@AllThingsJavaScript thank you very much.
@kartp2869
5 жыл бұрын
is it possible that output of one promise can be use as input for another promise. If yes can you direct me how to do that.
@kartp2869
5 жыл бұрын
I must say the most meaning video on chaining. Thanks a lot and keep up the good work
@AllThingsJavaScript
5 жыл бұрын
Yes, you would do that by issuing another promise. Does that help?
@Arty47
5 жыл бұрын
cool
@MrMarkgyuro
4 жыл бұрын
so it is always better to convert data to json ?
@AllThingsJavaScript
4 жыл бұрын
When using fetch it is how you access the data. You use the json method to convert the data to a format you can work with.
@MrMarkgyuro
4 жыл бұрын
@@AllThingsJavaScript thank you! n really precise video🤗
Пікірлер: 69