16.12: Promises Part 2 - Topics of JavaScript/ES6

  Рет қаралды 103,726

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 112
@Nonsense116
@Nonsense116 6 жыл бұрын
I love learning from you so much. The biggest bummer to learning things about programming is people tend to over complicate things when they don't need to. I guess to sound super smart??? Every time I watch a video from you nothing is over complicated. It's stated just how it is. THANK YOU! Also thank you for teaching me about promises.
@CameronChardukian
@CameronChardukian 5 жыл бұрын
I agree with you 100% Grant.
@victorgasparoni
@victorgasparoni 5 жыл бұрын
The bad thing about most developers is that they are the ultimate flexers.
@_unknown7_
@_unknown7_ 2 жыл бұрын
@@victorgasparoni 😐
@zee1598
@zee1598 3 жыл бұрын
Can I just say, I love your energy, you're making this learning process really fun.
@epictetus-nicopolis
@epictetus-nicopolis 3 жыл бұрын
I just come back and re-watch these videos, just to feel your positive energy. Thank you 😍
@MicheleMasina
@MicheleMasina 6 жыл бұрын
Hey Dan, just another quick tip to make your code slightly shorter. When you write .catch(err => console.error(err)) you can just write .catch(console.error) instead. This is the case every time you would call an arrow function with just one parameter, only to call another function on that parameter.
@saurabh75prakash
@saurabh75prakash 5 жыл бұрын
@Sph2329 do we need bind() here, I think the arrow syntax (even though not explicitly present) will take care of the context, so we need not fix "this" using bind IMHO.
@rampage9530
@rampage9530 4 жыл бұрын
Simply... you are an excellent teacher !
@predicate
@predicate 6 жыл бұрын
can someone please make a 10 hour version of 5:45?
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
I fully endorse this project idea.
@bbit-solutions7004
@bbit-solutions7004 6 жыл бұрын
gph.is/2P7lNDP
@beccaarauz
@beccaarauz 6 жыл бұрын
HAHAHAHAHA OMG NO, I almost had an anxiety attack with this
@CameronChardukian
@CameronChardukian 5 жыл бұрын
Haha that was a struggle
@ark333
@ark333 4 жыл бұрын
@@bbit-solutions7004 this doesn't work
@martinsonuoha
@martinsonuoha 6 жыл бұрын
Your tutorials are awesome!
@erfanrj2780
@erfanrj2780 2 жыл бұрын
I love your channel ! it's about 2 days that I found it. since I watched your first video about js, I search topics that I'm looking for, first.
@TheBarthinator
@TheBarthinator 6 жыл бұрын
oh my this is way easier than i thought
@FaithFedora
@FaithFedora Жыл бұрын
I have never been so excited to learn programming 😊😊😊
@dongyoungkim962
@dongyoungkim962 2 жыл бұрын
amazing explanation that takes time to actually how each component works in depth.
@Gottii92
@Gottii92 6 жыл бұрын
who's watching this in the year 3122? 11:11
@jurjenvanderhoek316
@jurjenvanderhoek316 5 жыл бұрын
Maybe you will be in one of your future incarnations
@ouza1430
@ouza1430 6 жыл бұрын
you are a gifted professor
@11am
@11am 5 жыл бұрын
i just love the way you teach, it is just so engaging! thank you so much!
@robocop30301
@robocop30301 6 жыл бұрын
Very informative, and also entertaining. Thank you!!
@t100210022002
@t100210022002 4 жыл бұрын
You really are a great teacher.
@navdeepbhanderi
@navdeepbhanderi 2 жыл бұрын
Great teacher on the earth 🌎.
@nnrmnlg
@nnrmnlg 6 жыл бұрын
Could you do some more native javascript? I feel like it would be interesting
@amanhaman8568
@amanhaman8568 6 жыл бұрын
despite knowing most of the stuff, it:s entertaining to watch. nice!
@Cloud-577
@Cloud-577 4 жыл бұрын
My fav channel!!
@JBahrsShiz
@JBahrsShiz 5 жыл бұрын
Noob question: at 3:41 you have delay() called on line 3, but defined on line 7. How does this work? I thought you had to define before calling. I could be mixed up too as I have limited experience. Got the code bug and trying to learn.
@IbnuCuruk
@IbnuCuruk 5 жыл бұрын
Jason Bahr Functions that are written like that are hoisted; it means that the program can run it, even though they are written somewhere else of where they are called. Every function notations have their pros and cons. Please correct me if I’m wrong. I’m still a noob too.
@martutittu
@martutittu 4 жыл бұрын
When you walk between frames it reminds me so freakin' much of logi mouse moving between screens :). Great tut, thank you !
@어깡갱
@어깡갱 6 жыл бұрын
Daniel you're Genius!!
@nomangulkhan
@nomangulkhan 6 жыл бұрын
*You're Just amazing!!!!!!*
@idontevenknow3707
@idontevenknow3707 6 жыл бұрын
Hi DAN! not supposed to be here, still on the p5js tutorials, I SHALL CATCH UP THOUGH! Peace & Love on the CodingTrain! CHOoOOOoOoooOOOoOCHooOOOoOOO
@jxs489
@jxs489 10 ай бұрын
Great video! Thank you so much
@tbntdima
@tbntdima 6 жыл бұрын
I was reading eloquent js for 4 days, and couldn't get this topic. Thanks for video!
@GeeVaaz
@GeeVaaz 6 жыл бұрын
10:35 - YMCA
@Caraxian
@Caraxian 6 жыл бұрын
I know all this but you make it so interesting to watch so I like to watch anyway :D
@Caraxian
@Caraxian 6 жыл бұрын
Can’t wait for async/await since I’m not quite familiar with them
@JBahrsShiz
@JBahrsShiz 5 жыл бұрын
Thank you!
@shifter65
@shifter65 4 жыл бұрын
Really like your ES6 explanations. Any plans to do more?
@TheSaintsVEVO
@TheSaintsVEVO 4 жыл бұрын
2:00 aww 😂
@clevermissfox
@clevermissfox Жыл бұрын
How are the functions noCanvas() and createP() working ? Where are they defined ?
@TheCodingTrain
@TheCodingTrain Жыл бұрын
These are part of the p5.js library! p5js.org/
@clevermissfox
@clevermissfox Жыл бұрын
@@TheCodingTrain only first heard of p5 on your channel. Will check into it!
@user-zp1dv4yh5e
@user-zp1dv4yh5e 4 жыл бұрын
Did you created the pj5 library?
@marlon4008
@marlon4008 6 жыл бұрын
where does that resolve and the reject come from? is it a promise method?
@attilatoth268
@attilatoth268 5 жыл бұрын
No. It's just a callback passed to the Promise constructor. The name resolve and reject is just a convention, but you can name it anything, it doesn't really matter.
@etymology_
@etymology_ 6 жыл бұрын
I may have missed this..but what is the createP..his HTML id? or is that a js method that appends the return data?
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
It's part of the p5.js library, see: p5js.org.
@davidyankee1986
@davidyankee1986 6 жыл бұрын
Thanks Daniel... very Useful do you have any video or plan of video where we get data from firebase using a searchbox?
@maheenkhurram
@maheenkhurram 6 жыл бұрын
Thank you very much really nice video. made simple and jokes are timely and interesting.
@RSTao77432
@RSTao77432 5 жыл бұрын
Hi, you have a SetUp Function() then you have a NoCanvas Function.. Jusst curious! Does Javascript automatically create a canvas in the DOM? & if so/ or not... is NoCanvas a native JS function itself? or have you defined that elsewhere? Promises looking handy.
@juschu85
@juschu85 6 жыл бұрын
8:40 Yes, it works. But why. You didn't put an else block around setTimeout and you don't return after you call reject. So even if the isNaN function returns true it should still execute setTimeout. Does that mean the function which is passed to the Promise constructor automatically returns after the function passed in the second argument is called? If yes, I don't like that. That should be in the control of the developer.
@kebman
@kebman 6 жыл бұрын
No. Pretty sure you have to manually return it, as it's also a matter of security.
@juschu85
@juschu85 6 жыл бұрын
kebman I didn't watched it all over again, but I think later (in another video(?)) he also noticed that he made a mistake at this point.
@nomtijorti
@nomtijorti 5 жыл бұрын
no it won't. by default what comes after and if it considered else.
@attilatoth268
@attilatoth268 5 жыл бұрын
It works because promises don't change after they settled (either fulfilled or rejected). So you cannot have a promise that will reject after 1 second, but then resolve after 2 second. In this implementation the setTimeout still happens, the resolve function will be called (after the delay), but it won't change the rejected promise into a fulfilled one.
@kebman
@kebman 6 жыл бұрын
*fetch()* still isn't built into Node.js, so in the mean time you need to do *npm install node-fetch --save*
@andromilk2634
@andromilk2634 Жыл бұрын
What I don't get is that when setTimeOut calls resolve, what does resolve do exactly? Is it a function which does nothing? Thanks
@jpc501
@jpc501 6 жыл бұрын
Superb
@IsfhanAhmed
@IsfhanAhmed 6 жыл бұрын
can you make video on javascript and ecmascript without p5.js
@anmaraziz8360
@anmaraziz8360 3 жыл бұрын
your just amazing please keep doing things just the way u r funny & simple
@jorgelightwave
@jorgelightwave 5 жыл бұрын
I'm learning a lot with your videos! PS: ES stands for EcmaScript
@amirulidzham3686
@amirulidzham3686 5 жыл бұрын
Hello, why I need to use resolve() in my code. If not, then will never execute. I'm not sure it is related to angular. I have new Promise(resolve,reject). I expected that it will continue to execute and auto return resolve and if any error will return rejected
@grownmancrying
@grownmancrying 5 жыл бұрын
My coworker told me you look like Hugh Jackman. Anyway thanks for the video man, love from PH.
@notarealhandle123
@notarealhandle123 5 жыл бұрын
Promises are made to be broken. Does it work here as well?
@Caraxian
@Caraxian 6 жыл бұрын
You should really cancel execution of the function after rejecting otherwise the program will be running the setTimeout to resolve a rejected promise which is a waste of system resources :)
@Caraxian
@Caraxian 6 жыл бұрын
Oh it’s fixed I’m the next video, which is unlisted :)
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
yeah, i goofed!
@tempest_dawn
@tempest_dawn 6 жыл бұрын
Good to hear it's fixed in the next one, but yeah it's really good to get in the habit of always returning if you reject or resolve a promise as I believe calling any of those functions more than once can result in undefined behavior?
@Caraxian
@Caraxian 6 жыл бұрын
Cole Erickson depends on what it’s doing, but yea. The promise itself will be fine since it can only resolve or reject once but doing the action anyway could cause some problems elsewhere in some cases
@siluverukirankumar9954
@siluverukirankumar9954 6 жыл бұрын
Is delay, resolve and reject are JavaScript built in keywords?
@RakeshBitling
@RakeshBitling 4 жыл бұрын
You Videos are excellent please make javascript AWS developer S3 videos 👍👍👍👍
@ericvaldez174
@ericvaldez174 6 жыл бұрын
Do you still write program people of year 3122?
@santiagojaramillorodriguez8272
@santiagojaramillorodriguez8272 3 жыл бұрын
how can I see my code in the browser? :(
@Vibestr
@Vibestr 2 жыл бұрын
anyone notice that the output from the resolve never got delayed? I applied this code inside a console and it delayed it by the time indicated, but the createP method displayed the message right away. edit: i figured out my issue. The setTmeout() has to have a callback argument as follows and then the delay works: if (isNaN(time)) reject(new Error(time + " is not a valid number")); else setTimeout(() => resolve("test resolved"), time);
@martinbozinovski
@martinbozinovski 5 жыл бұрын
I am the only one that is trying codes? @7:15 the code doesnt work, at least not for me. Where am i taking a mistake? Here is the code, maybe can someone tell me with just a look at it: function setup() { delay(1000) .then(() => createP('Hello')) .catch((err) => console.error(err)); } function delay(time) { return new Promise((resolve, reject) => { setTimeout(resolve, time); }); }
@akinbolaoluwaferanmi898
@akinbolaoluwaferanmi898 5 жыл бұрын
think its because he uses p5.js which you might not be using
@alizahid4742
@alizahid4742 6 жыл бұрын
where the react tutorials at. thank you
@TutocarloCV
@TutocarloCV 6 жыл бұрын
nice
@akinbolaoluwaferanmi898
@akinbolaoluwaferanmi898 5 жыл бұрын
Hello, guys am a little bit confused tried running similar code in vanilla javascript while it works, the timing is completely off. the function runs immediately in the browser. delay(9000) .then(document.write('Promise is sucessful')) .catch(err => console.error(err)) function delay(time){ return new Promise((resolve,reject)=>{ setTimeout(resolve,time); }); }
@shonendumm
@shonendumm 2 жыл бұрын
Hi I encountered a similar issue, my resolve was returned immediately without delay. Then I read that it's because I wrote it as setTimeout(resolve(), time) . Note the parentheses. It should be setTimeout(resolve, time) . But I see that yours is written without parentheses, so it should run with delay though. That's strange.
@romanemul1
@romanemul1 6 жыл бұрын
looks like we are heading times where java will be updating each few hours.
@Ineffable_Wisdom
@Ineffable_Wisdom 6 жыл бұрын
Can anybody tell me what the noCanvas() function is for?
@jayakrishnalakkoju453
@jayakrishnalakkoju453 4 жыл бұрын
Let CodingTrain = () => setTimeout(()=>♥️, 1000); CodingTrain();
@shineten4961
@shineten4961 6 жыл бұрын
what is p5?
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
p5 is a library for JavaScript, for more: p5js.org.
@Nampjg
@Nampjg 4 жыл бұрын
using the Promise(resolve,reject) was almost felt to me like cheating in examination or plagiarism :(
@jamoliddinz
@jamoliddinz 3 жыл бұрын
it's still relative)
@mkifd
@mkifd 4 жыл бұрын
Just came back from the year 3122 just to keep my promise 🤧
@chizll
@chizll 3 жыл бұрын
Hi to all those watching in the year 3122! Sincerely, 2021
@2e3crescens
@2e3crescens 6 жыл бұрын
@ayush.kumar.13907
@ayush.kumar.13907 6 жыл бұрын
The Anchor looks like Gilfoyle from Silicon Valley, LOL
@kebman
@kebman 6 жыл бұрын
What was I talking-saying?
@ramnathtejachekka7090
@ramnathtejachekka7090 3 жыл бұрын
who is watching this at 3422! ... all the people during lockdown be like "well it felt like millennium, so me!" :D
@Pareshbpatel
@Pareshbpatel 3 жыл бұрын
{2021-12-16}
@nomangulkhan
@nomangulkhan 6 жыл бұрын
How do you know that you have made any type of coding mistake? plz answer i am waiting!
@anibal9812
@anibal9812 6 жыл бұрын
You test your program to see if it behaves the way you expect it to or if any error messages pop up. There’s a paradigm called Test-Driven Development (or TDD) that helps to automate this kind of thing, but I wouldn’t recomento to a complete beginner to programming, as it requires using libraries and writing even more code. If you’re comfortable with these things, however, check it out, it’s an awesome way to program. In JavaScript specifically, you check how the page answers to your inputs, and if there’s any red messages in the console.
@nomangulkhan
@nomangulkhan 6 жыл бұрын
Thanks
@TheBarthinator
@TheBarthinator 6 жыл бұрын
You could lookup a linter plug-in for atom
@nomangulkhan
@nomangulkhan 6 жыл бұрын
Thanks BROTHER!
@ghazni101
@ghazni101 3 жыл бұрын
came for self help...going with self doubt
@codegate615
@codegate615 4 жыл бұрын
This is over-complicated. Use easier examples to teach brand new and difficult material.
@praneetmehta
@praneetmehta 5 жыл бұрын
Great video but your laugh is weird :P
16.13: async/await Part 1 - Topics of JavaScript/ES8
6:41
The Coding Train
Рет қаралды 166 М.
16.11: Promises Part 1 - Topics of JavaScript/ES6
24:53
The Coding Train
Рет қаралды 337 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
16.3: ES6 Arrow Function - Topics of JavaScript/ES6
22:32
The Coding Train
Рет қаралды 273 М.
JavaScript Promises In 10 Minutes
11:31
Web Dev Simplified
Рет қаралды 1,8 МЛН
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
How this LED Tech MADE IN CHINA is impacting the whole WORLD
15:54
Rafa Goes Around!
Рет қаралды 2,4 М.
16.5: Higher Order Functions in JavaScript - Topics of JavaScript/ES6
16:21
16.15: Promise.all() - Topics of JavaScript/ES6
11:44
The Coding Train
Рет қаралды 128 М.
'OXYGEN LEAK!'' Elon Musk Revealed WHY Starship Flight 7 Exploded...
11:01
Best Ways to Use Gemini 2.0 (over ChatGPT & Perplexity)!
16:06
Grace Leung
Рет қаралды 25 М.
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН