16.3: ES6 Arrow Function - Topics of JavaScript/ES6

  Рет қаралды 271,921

The Coding Train

The Coding Train

6 жыл бұрын

In this video, I cover anonymous functions with the arrow syntax in ES6 JavaScript.
Next Video on ES6: • 16.4: for...of loop - ...
Support this channel on Patreon: / codingtrain
To buy Coding Train merchandise: www.designbyhumans.com/shop/c...
To Support the Processing Foundation: processingfoundation.org/support
Send me your questions and coding challenges!: github.com/CodingTrain/Rainbo...
Contact:
Twitter: / shiffman
The Coding Train website: thecodingtrain.com/
Source Code for the all Video Lessons: github.com/CodingTrain/Rainbo...
p5.js: p5js.org/
Processing: processing.org
For an Intro to Programming using p5.js: • Start learning here!
For Coding Challenges: • Coding Challenges
Help us caption & translate this video!
amara.org/v/cJ4E/
📄 Code of Conduct: github.com/CodingTrain/Code-o...

Пікірлер: 518
@bte320
@bte320 5 жыл бұрын
I really like that you don't edit out your mistakes, these are the same mistakes I make and it's cool to see someone else going through the process. Makes your tutorials much more relatable.
@Winter_Wyvern1
@Winter_Wyvern1 2 жыл бұрын
While I agree, its similar to when we were in school and some kid starts talking about a particular cartoon, u are like "wow im not alone??? he's watching it too???" while EVERY kid is watching/has watched cartoon. Back to this example, at 2:30 he was wrong, i think he was refering to the Arrow FN as "it can ONLY be used as Anonymous FN" which is NOT true, and a big mistake which he should have corrected before uploading the video -> either a cut-addition of video explaining it, or a text of "NOPE I was wrong, you can assign them to a variable too.
@WistrelChianti
@WistrelChianti Жыл бұрын
I suspect the ones here were deliberate but for purpose as he's aiming to illustrate the gotchas and their fixes
@lesliehui
@lesliehui Жыл бұрын
@@Winter_Wyvern1 arrow functions are always anonymous regardless whether you assign them to a variable a not
@flieranonymous4588
@flieranonymous4588 6 жыл бұрын
Best programming teacher on internet..........
@haideralipunjabi
@haideralipunjabi 6 жыл бұрын
Flier Anonymous Agreed. Your opinion might change after watching the steams
@mohsinshaikh8944
@mohsinshaikh8944 6 жыл бұрын
Haider Ali Punjabi who cares the steam when you have coding train with you.... At least my opinions Will not..
@haideralipunjabi
@haideralipunjabi 6 жыл бұрын
mohsin shaikh My opinion, you learn things like debugging, mistakes, etc from the stream only
@bastifmbh
@bastifmbh 6 жыл бұрын
i find it very interesting how other programmers approach a problem.. and just watching the progress and the thinking of someone like daniel really helps a lot imho.. unless you're an expereinced professional yet i guess..
@BonefxInaxclan123
@BonefxInaxclan123 6 жыл бұрын
Urmmmmm travesy media check him out you will thank me later
@LandonHughes2
@LandonHughes2 6 жыл бұрын
Daniel, I literally CANNOT thank you enough! You are an UNBELIEVABLY amazing teacher!! Thank you SO much! I've wanted to understand how a computer thinks since I was exposed to them at the age of 5 (I got my first Gameboy with Yoshi's Island). I wanted to learn how to make games. The first time I was ever exposed to programming was my Junior year of high school (had a Java class). I hated it for the fact that my teacher was horrible! Nothing made sense. I wanted to like programming so much! Fast forward a few years later (2015), I took some Python courses, Swift courses, and C# courses on Udemy. All of them were incredibly basic and the instructors were very boring. I picked up all the basic things such as if/else logic, different data types, for loops/while loops, etc. All of them ended the same way; once they got to classes and objects, I gave up. Fast forward another year (2016) I picked up GameMaker, which is easy to understand for beginners. Everything that I learned in those courses transferred over nicely, but when it got time to debug, I gave up again :/ Now fast forward into 2018, I found you! I remember you showed up in my Suggested Videos with your "Coding Challenge: Flappy Bird video". I subbed instantly! It was until this past week I watched your P5.js and Node Tutorials. I am SOOO glad I did. Like I said, computers have always fascinated me at young age. Thank you for teaching me the gift of programming! Thank you, thank you, thank you! I love that everything is starting to click now, which is what I wanted from the start. I'm pretty sure your style of teaching is how I'm able learn. Like I said in this comment and in previous comments, you are an unbelievably AMAZING teacher! Reading debugging errors is making SO much more sense now. Thank you so much times 1000 and keep up these awesome videos :)
@shubham-itachi
@shubham-itachi 5 ай бұрын
What are doing now it's been half decade.
@pbznt
@pbznt 3 жыл бұрын
I begin programming on Codecademy, and in 1 month I will begin an official coding course in college. I needed a channel like yours to get motivated and the way you explain everything is very fun and simple. Very entertaining and motivating!:) (From Quebec, Canada)
@benmoren5828
@benmoren5828 6 жыл бұрын
This video @ 5:46 totally saved me recently from so many `var that = this` statements in a recent project. I'm totally hooked on the arrow functions now!
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
I'm so glad to hear this!
@benmoren5828
@benmoren5828 6 жыл бұрын
Heres what I was working on, it's not a sketch, but it is p5 related :) : atom.io/packages/p5js-toolbar
@mrss649
@mrss649 3 жыл бұрын
@@benmoren5828 Im going to download that tommorow. Kepp developing!
@mrss649
@mrss649 3 жыл бұрын
@@benmoren5828 oh and also, 1: Can you share the source code for that because that would be cool 2:Where did you learn to make stuff like that
@BenMoren
@BenMoren 3 жыл бұрын
@@mrss649 Source is available in the github repository here: github.com/bmoren/p5js-toolbar.
@piczel9631
@piczel9631 6 жыл бұрын
Please don't stop do what you do. You are so funny and entertaining while still being extremely helpful => crucial things for an amazing teacher!
@vincej151
@vincej151 4 жыл бұрын
You are truly gifted! I have watched hundreds of tutorials. I build complex software. And you are the best I have seen.
@KurtSchwind
@KurtSchwind 6 жыл бұрын
I've been using arrow functions for a while. It took a bit of time to wrap my head around some of the advantages but now it's nearly second nature. Good video. Keep up the good work.
@caio-jl6qw
@caio-jl6qw 5 жыл бұрын
I love this channel. I've learnt so much about JS since I started watching you.
@presshun
@presshun Жыл бұрын
Watching 5 years later to the day, so spooky was relatable! :D Thanks for the great vid!
@shivam_0002
@shivam_0002 5 жыл бұрын
11:43 You are making the World a Happy Place by the way you teach.
@newesttechdesigninnovation8121
@newesttechdesigninnovation8121 Жыл бұрын
Might be the best teacher i came across and i usually dont even comment on peoples videos
@samhero479
@samhero479 4 жыл бұрын
This guy is so friendly and full of life. Kudos to your contagious enthusiasm! Much love.
@phil5992
@phil5992 4 жыл бұрын
this guy is a total goober and good lord do i love it. i had a college math professor EXACTLY like this, and you sir, captivate my attention. you got yourself another avid viewer!
@jaldipupadhyay4910
@jaldipupadhyay4910 5 жыл бұрын
It was so helpful and you are truly humble. I laughed at 8:22 when you said, if you are still watching this video you are really nice person LOL. I don't know how can we payback to people like you. Cheers
@judeaf.4393
@judeaf.4393 Жыл бұрын
You're so quirky, I love it!!! Awesome, clear explanation. I needed this clarification before I read any more reference articles... sometimes they can become confusing or simply do not explain enough and I am left with questions. Awesome, awesome explanation- thanks!
@blargflarg
@blargflarg 5 жыл бұрын
Holy crap. I absolutely love watching your videos on JS. JS has been one of the toughest languages I've come across, and you make it understandable and easy. Thank you!
@KayinAngel
@KayinAngel 5 жыл бұрын
Been watching a bunch of your videos lately, and am unsure if your "mistakes" actually are genuine mistakes or planned examples of mistakes, but for some reason it seems to help me learn and retain better than someone whipping through it without explaining why something fails if done wrong. I dig.
@surajkawale2763
@surajkawale2763 4 жыл бұрын
Never ever stop teaching programming.I wish i could like this video 3000 times
@Engineer9736
@Engineer9736 5 жыл бұрын
These videos really update my Javascript knowledge properly. To stay uptodate one needs input from somewhere.. could be a forum community or official documents, but these videos are just easy. Just press play and follow along 🙂
@AdamMalesevic
@AdamMalesevic 11 ай бұрын
The best explanation of Arrow function on KZbin 🎉😊
@SayanChakraborty10397
@SayanChakraborty10397 4 жыл бұрын
Every time I forget any concept, this is the first (and sometimes the only) place I refer to. Thanks a lot!
@christopherLife
@christopherLife 4 жыл бұрын
This is what a man who loves coding and teaching looks like!
@robocop30301
@robocop30301 5 жыл бұрын
So happy that I found this channel! Thanks for all the help!
@konkenbonken
@konkenbonken 4 жыл бұрын
I just realised that you make really great tutorials as well as your coding challenges. I've just watched those(and I love them❤).
@TheWWWyrm
@TheWWWyrm 6 жыл бұрын
What helps me to use const more often is using a linter set to highlight all variables that are never assigned and not const. Really helps in keeping code clean and understandable!
@someenglishgames
@someenglishgames 6 жыл бұрын
Was very helpful in node.js to get a simple declaration for a function for a callback
@akosbarabas22
@akosbarabas22 4 жыл бұрын
Best explanation i could imagine, all i can say is thank you!
@trollanddrump5326
@trollanddrump5326 4 жыл бұрын
Never in my entire life have I ever felt so much discomfort and anxiety over something as trivial as 2 bytes of tormenting equality symbols! Some nights when I don't get some sleep, I think it's because of the => like it's some kind of evil emoji jeering at me.
@Bigsupreme2000
@Bigsupreme2000 2 жыл бұрын
Some gusta who introed it did not realize a lot of amateurs gonna get lost at it 😂
@vibsh625
@vibsh625 4 жыл бұрын
7:00 It makes perfect sense, thanks you cleared the doubts i had on react event binding.
@krushna7467
@krushna7467 3 жыл бұрын
The way u simply all the concepts is just awesome 💜 Thanks a lot!!!
@tonyp3173
@tonyp3173 5 жыл бұрын
This is probably the single best video you've ever did let alone the internet.
@2ru2pacFan
@2ru2pacFan 2 жыл бұрын
You and AutomationCat are the best coding teachers on the internet
@pradiptahafid
@pradiptahafid 4 жыл бұрын
Hi Dan, As a beginner, I just want to let you know that your error is more valuable than the actual code that works. It saves me hours of time to figure out what's wrong with my code. That is why I always following your channel and reproducing the code that you made. Thanks for the information sharing.
@davidpark9020
@davidpark9020 5 жыл бұрын
Days of reading articles, blogs, books and still can't get it. This guy made me understand this within 20 min. Thumbs up high.
@tekoreypy
@tekoreypy 4 жыл бұрын
I agree, to try new thing in programming is also interesting/exiting/spooky/terrifying/and whatevea, I used to avoid these things, but even if you say there is no reason to be afraid of them, you will always find something you don't want to start using, thanks Theacher Shiffman for encouraging us to try new things
@jobayerrifad544
@jobayerrifad544 3 жыл бұрын
I've never smiled while watching a tutorial unitl 8:15
@kereshim
@kereshim 6 жыл бұрын
Love your explanations and enthusiasm!
@brutalbutler
@brutalbutler 4 жыл бұрын
my fav teacher, wish i had you as a lecturer
@MrT246007
@MrT246007 6 жыл бұрын
Your vids help me so much. I'm new to programming and you dumb things down really well. Thank you for what you do.
@fracasj
@fracasj 3 жыл бұрын
You might have changed your opinion of the arrow function three years later (or not haha), but it's extremely vindicating as a new coder working their way to ES6 how frustrated you are by it! It's stumped me so many times and I'd much rather write out the function in total! But this helps a lot and maybe I'll learn to embrace it. Thank you again for another helpful tutorial!
@GraceandWisdom
@GraceandWisdom 3 жыл бұрын
Daniel Schiffman, you are an awesome teacher and I understand most of what I don't know after you have shown me!!
@MrWardo2009
@MrWardo2009 5 жыл бұрын
That was epic! Thanks so much for making this video! It was explained really well!
@kingmonger4456
@kingmonger4456 4 жыл бұрын
I LOVE this mans videos so much, he makes it enjoyable while learning. so much personality.
@ObyMikelPS3
@ObyMikelPS3 4 жыл бұрын
You are amazing. It didn't solve my question but... I learned new amazing things and also discovered you. From a begginer in programming in Spain, thank you and keep it up!
@rubenjwz
@rubenjwz 3 жыл бұрын
You're always able to humanize programming for me, and I thank you for it :)
@ArnoldsKtm
@ArnoldsKtm 6 жыл бұрын
Recently learned about arrow fns while messing with node. It was confusing at first but it's basically just a shorthand function which ends up being much cleaner. Now I try to use it whenever.
@iskariotas
@iskariotas 6 жыл бұрын
ArnoldsK there are catches with it tho. The scope is different than normal foos.
@dvorapat
@dvorapat 6 жыл бұрын
@Nikolajus Exactly! It is not just "shorthand function". It could be clearly seen in the video with the Counter class example that it is not the same, because arrow functions use lexical scoping. I found this article helpful to tell a difference between "standard" function and arrow functions: derickbailey.com/2015/09/28/do-es6-arrow-functions-really-solve-this-in-javascript/
@sakif7
@sakif7 4 жыл бұрын
This was so well explained. Thank you so much!
@therobot4779
@therobot4779 4 жыл бұрын
watching in the future on a micro binge, that was such a weird intro and i loved it
@lucyvrxo
@lucyvrxo 6 жыл бұрын
NEW SUBSCRIBER ~ your teaching style is so great! love your energy. can't wait to see more videos from you.
@PirateCaptain_ThunderHook
@PirateCaptain_ThunderHook 2 жыл бұрын
this is really helpful, thanks for having this video on the internet.
@arshadjaveed7877
@arshadjaveed7877 6 жыл бұрын
Arrow function => Lambda expressions ;)
@ruffianeo3418
@ruffianeo3418 5 жыл бұрын
Wait for his video once Haskell Arrows make it into ES 42 ;)
@protondecay4607
@protondecay4607 3 жыл бұрын
It's a bit different from regular functions in that the current execution context(this) refers to the Global (or undefined, if you're in strict mode) instead of the function itself for regular functions
@cprogramming5640
@cprogramming5640 6 жыл бұрын
That is spooky. Code used to be cryptic and the emphasis has been on making programs more readable. Now we are headed back to more cryptic. Spooky “crypt”ic
@youngcitybandit
@youngcitybandit 4 жыл бұрын
No it isnt... it is as readable as ever if you know what youre doing you can make anything readable.
@momahdy
@momahdy 4 жыл бұрын
you gotta learn the language so you can read it
@0xssff
@0xssff 4 жыл бұрын
From low level to high level to low level "syntax"..
@roltthehunter
@roltthehunter 6 жыл бұрын
I just started coding with js a month ago i studied for 130 hours and i personally love arrow functions i feel like using them makes my code look more professional
@syedbaryalay5849
@syedbaryalay5849 6 жыл бұрын
Watching this video was the most fun part of my day
@sanishchirayath4149
@sanishchirayath4149 2 жыл бұрын
I love this...Especially the 'CONST conter1'.., Thanks for making learning code fun
@PaulMcCannWebBuilder
@PaulMcCannWebBuilder 5 жыл бұрын
Your mess up at 14:34 is the perfect learning opportunity to understand const! The fact that you don't edit those kinds of things out sets you apart from most teacher and tutorials. I'm going to pretend to make this mistake in my own classes!
@anrskp
@anrskp 6 жыл бұрын
awesome content on this channel! keep up the good work.
@silvanarojas5380
@silvanarojas5380 5 жыл бұрын
I like how you explain this topic.
@boultifnidhal2600
@boultifnidhal2600 2 жыл бұрын
You're the best teacher on earth, I love your intros so much.
@yunhann
@yunhann 5 жыл бұрын
Finally understand it, thank you so much!
@lswan6150
@lswan6150 5 жыл бұрын
Great video, very well explained!
@NatetheAceOfficial
@NatetheAceOfficial 6 жыл бұрын
I just need an excuse to apply the UnicornFluffyTimes function to make my project particularly magical.
@ohiriboi1872
@ohiriboi1872 6 жыл бұрын
It’s my first time to watch JS but am impressed 1000000%
@ibknl1986
@ibknl1986 6 жыл бұрын
Very nice way of teaching. Quite energetic
@jorgedavalos5663
@jorgedavalos5663 3 жыл бұрын
the good old blackboard!! def works great for explaining things ! nobody uses it though! hope some other guys that teach coding learn from you. cheers!
@AliveNotDeadmund
@AliveNotDeadmund 3 жыл бұрын
Oh my god, that was hilarious! THANK YOU for unpacking The Spooky Arrow into a much more friendly concept.
@jorgel9041
@jorgel9041 5 жыл бұрын
The spooky intro music is ok even in summer. They're spooky dude
@alan614
@alan614 6 жыл бұрын
Video rocked ! Thanks for making it. I learned a lot :)
@dinoXman
@dinoXman 4 жыл бұрын
Wow.. he's very good at drawing horizontal straight line.. amazing
@leinf4464
@leinf4464 6 жыл бұрын
The arrow functions seem like a part of kinda functional programming in Javascript and seem to be similair to the lambda expresions notation in Java to me. Great tutorial video as always :D
@MrJatinpatodi
@MrJatinpatodi 5 жыл бұрын
Very nice. A funny and easy way to learn complex stuff...great teaching skills
@MikahFSMusic
@MikahFSMusic 3 жыл бұрын
This man is a fantastic teacher
@mrshurukan
@mrshurukan 6 жыл бұрын
Awesome explanation! I resent this to my friend who didn't know the whole thing about those arrow functions! Thank you so much
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Glad to hear, thank you!
@wendusyaputra
@wendusyaputra 6 жыл бұрын
This guy is so funny. But honestly i would say that he is the best teacher on the internet
@user-qn8uy5mj4c
@user-qn8uy5mj4c Жыл бұрын
I really like your style of lecturing
@warrenwong4518
@warrenwong4518 3 жыл бұрын
You have a gift for teaching!
@lofofojb
@lofofojb 2 жыл бұрын
This channel is so cool ! Thanks you Coding Train !
@m7amedk
@m7amedk 5 жыл бұрын
Looove you energy 🙏💜 You rock!!
@craigburton4447
@craigburton4447 3 жыл бұрын
14:01 love the sound board
@waterbottlexd1298
@waterbottlexd1298 2 жыл бұрын
What an interesting person. Really makes it easier to learn.
@muhammadaadil3546
@muhammadaadil3546 4 жыл бұрын
This video is better than the udmey courses for learning javascript
@scottibr2
@scottibr2 5 жыл бұрын
thx, you just got my like by making me giggle about "unicorn fluffy times"
@thydevdom
@thydevdom 4 жыл бұрын
Loool. The opening. Great video!
@menechimkasparow4182
@menechimkasparow4182 6 жыл бұрын
Great video spread the good word about the arrow function
@barszrhl445
@barszrhl445 2 жыл бұрын
You are funny guy, I watched without cutting whole this video in normally always used to skipped,anyway thanks for helping.
@mohsinshaikh8944
@mohsinshaikh8944 6 жыл бұрын
He is nice guy
@deecee2204
@deecee2204 5 жыл бұрын
nice vid. my kind of mindset and teacher
@stanleyjaxen5043
@stanleyjaxen5043 Жыл бұрын
thanks so much the world is a better place most my teachers taught this like "nu nu nurr and an arrow!... next topic"
@WistrelChianti
@WistrelChianti Жыл бұрын
if for some reason I had a reference to the current object as it would be seen by something with a global scope, could I use that to reference the object function as the callback in setInterval? I find myself wondering the exact difference between an unnamed function and the arrow function now (aside from a more concise syntax) as one works in this context but the other does not...
@NITROjkee
@NITROjkee 6 жыл бұрын
great explanation
@schlaus_kwab
@schlaus_kwab 4 жыл бұрын
Great video, thanks!
@joesminis
@joesminis 5 жыл бұрын
You have just cleared up so much for me and I am only 3 minutes in
@artakan303
@artakan303 6 жыл бұрын
I love you ;-) You make me smile watching you !
@andreas6218
@andreas6218 5 жыл бұрын
It is really helpfull on the addeventlistener function
@anisaa2046
@anisaa2046 2 жыл бұрын
Wow ur tutorials are amazing
@mephesh
@mephesh 5 жыл бұрын
18:15 *mindblown* great demonstration of how function() {} and () => {} have different this behaviour
@akhtar7574
@akhtar7574 3 жыл бұрын
I'm a nice person!! You just made my day. I waited for you to tell me that before stopping the video. Just kidding. I watched the whole video.
@adaliadasilva4200
@adaliadasilva4200 2 жыл бұрын
Lemme tell you, you are great at explaining. (Y) Love your euphoric energy. Super pure! :)
@joshgrosss
@joshgrosss Жыл бұрын
Watching this 10/28/2022 and still extremely helpful :)
16.4: for...of loop - Topics of JavaScript/ES6
3:52
The Coding Train
Рет қаралды 119 М.
16.7: Array Functions: reduce() - Topics of JavaScript/ES6
14:40
The Coding Train
Рет қаралды 132 М.
She’s Giving Birth in Class…?
00:21
Alan Chikin Chow
Рет қаралды 11 МЛН
Ну Лилит))) прода в онк: завидные котики
00:51
How many pencils can hold me up?
00:40
A4
Рет қаралды 19 МЛН
The Async Await Episode I Promised
12:04
Fireship
Рет қаралды 1,1 МЛН
JavaScript ES6 Arrow Functions Tutorial
9:32
Web Dev Simplified
Рет қаралды 813 М.
9.19: Prototypes in Javascript - p5.js Tutorial
19:24
The Coding Train
Рет қаралды 257 М.
JavaScript Function - What's your Function?
12:27
Fireship
Рет қаралды 179 М.
16.1: let vs var - Topics of JavaScript/ES6
12:20
The Coding Train
Рет қаралды 221 М.
Coding Challenge 124: Flocking Simulation
42:27
The Coding Train
Рет қаралды 323 М.
16.6: Array Functions: map() and fill() - Topics of JavaScript/ES6
14:26
The Coding Train
Рет қаралды 113 М.
Arrow Functions JavaScript Tutorial - What NOT to do!!!
31:48
ColorCode
Рет қаралды 51 М.
16.11: Promises Part 1 - Topics of JavaScript/ES6
24:53
The Coding Train
Рет қаралды 332 М.
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 743 М.
She’s Giving Birth in Class…?
00:21
Alan Chikin Chow
Рет қаралды 11 МЛН