Thank you so much for your explanation! I was searching for a particular video that could cover a lof of ground on api and I found it. Your explanation is clear and precise and doesn't make any problems to understand comparing to the content in my native language
Hi, mastering JavaScript is critical if you want to be a modern, professional developer: www.udemy.com/course/professional-javascript-course/?referralCode=0C1D5752923168BC87C2 Also, if you are a front-end developer then mastering CSS (including Flexbox, CSS Grid, etc.) is equally important: www.udemy.com/course/professional-css/?referralCode=4C3C08E82629E6B15752
Thanks for the video! Very useful! I have a few questions: @ 3:29 line 6 1) is this return statement mandatory/necessary? 2) How can we use this return statement? I'm trying to store the json data retrieved by fetch like this: let words = fetch('words.json').then(res => {return res.json()})... or return the data in the next then() block but instead of the the array i'm expecting to get i'm getting a promise object. Of course i can declare a global array var and assign the res.json() to it... but i thought all these new features could somehow eliminate the use of global vars. Any ideas please?
1) Yes, res.json() alone gives us a promise. We should return that promise. 2) I'm not sure what you mean exactly. After returning the promise in the first .then() block we get the value with which that promise resolves in the second .then() block.
@@ByteGrad Thanks for the reply 2) What I mean... ie fs.readdir comes in 2 flavors, one sync one async. If i want to use the array returned by the function at a later time I can use the sync version. Is there anything similar in fetch as well? ie something like var mydata = fetch("blah').then(another blah).then(...); Or the only way to store this data is something like: var mydata; fetch("blah').then(another blah).then(data=>{ mydata = data;} ); The 2nd way works for me but it doesn't look very... elegant !
@@bitcollector6285 Second way is how it would work, yes. Check out my async/await with fetch video, that syntax is more elegant. Or just go straight to my Professional JavaScript course to see how it works with realistic projects