6.2: Classes in JavaScript with ES6 - p5.js Tutorial

  Рет қаралды 399,529

The Coding Train

The Coding Train

Күн бұрын

This video introduces Object-Oriented Programming in JavaScript with ES6 classes and the p5.js library. Code: thecodingtrain.com/tracks/cod...
🕹️ p5.js Web Editor Sketch: editor.p5js.org/codingtrain/s...
🎥 Previous video: • 6.1: Introduction to O...
🎥 Next video: • 6.3: Constructor Argum...
🎥 All videos: • Start learning here!
Timestamps:
0:00 Introduction
3:09 Encapsulation
3:37 Using Classes as a Template for Objects
8:40 The constructor() Function is the Object's Setup
10:10 Using “this.” to Declare Class Variables
12:26 Code Example
14:50 Adding Functionality to a Class
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
🚂 Website: thecodingtrain.com/
👾 Share Your Creation! thecodingtrain.com/guides/pas...
🚩 Suggest Topics: github.com/CodingTrain/Sugges...
💡 GitHub: github.com/CodingTrain
💬 Discord: / discord
💖 Membership: kzbin.infojoin
🛒 Store: standard.tv/codingtrain
🖋️ Twitter: / thecodingtrain
📸 Instagram: / the.coding.train
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 p5.js Web Editor: editor.p5js.org/
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
#basics #oop #objects #p5js #javascript

Пікірлер: 586
@MattCurney
@MattCurney 5 жыл бұрын
"What does it mean to be a bubble?" I literally understand Classes now because of this adorable man
@bernardnoctor5627
@bernardnoctor5627 3 жыл бұрын
If I wasn't unemployed I would subscribe to desperate dan he is funny I like his real bell and he helped me to understand oops
@jonahmorgan2474
@jonahmorgan2474 6 жыл бұрын
His ramble about "What does it mean to be a bubble?" makes more sense if you know he got a Bachelors in Philosophy, as well as Mathematics. Just a fun fact.
@JakeWHamilton1
@JakeWHamilton1 4 жыл бұрын
I also have a degree in philosophy and have been naturally drawing the analogies between phil and coding as I learn. Have been trying to explain these connections to my brother (programmer, no phil) who just won't hear it...immediately sent tthis video his way. one day ill convince him he is actually a philosopher on the cutting edge of ontology, asking 'what does it MEAN to be a programmer!?'
@millanferende6723
@millanferende6723 3 жыл бұрын
@Jacob Hamilton Don't you mean what does it MEAN to be an object? 😏
@kamelyehya2182
@kamelyehya2182 3 жыл бұрын
@@millanferende6723 A woman once said.
@x7w6
@x7w6 3 жыл бұрын
@@kamelyehya2182 quick witted
@martynconkling8876
@martynconkling8876 2 жыл бұрын
lol nice, Bubbles are quite a cool mathematical concept to think about no matter what age you are!
@carllitabobita
@carllitabobita 2 жыл бұрын
Some educational coding videos are hard to watch: 10 minutes feel like the longest, driest eternity. With your videos, 10 minutes pass so quickly, and I learn a lot! Thank you so so much for your content!
@JustinSulak
@JustinSulak 3 жыл бұрын
We live in an age where it doesn't matter if I don't understand a single word my professor is saying, because I can come to KZbin and learn ten times more! Thank you for this video series!
@lookupverazhou8599
@lookupverazhou8599 2 жыл бұрын
Well, if you think throwing away money doesn't matter...
@Alessandro-nq3tm
@Alessandro-nq3tm 6 жыл бұрын
You are the best teacher in the world!! :)
@noxid86
@noxid86 4 жыл бұрын
For real, youtube should pay this guy more
@romanemul1
@romanemul1 6 жыл бұрын
a question that has been burnt into my mind after watching this video. "Hows to be a bubble ? " Im going to think about that for a very long time.
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
mission accomplished!
@jelto-tankredbasel9060
@jelto-tankredbasel9060 6 жыл бұрын
Now that I know how to be a bubble... I am afraid of bursting at any moment...gosh being a bubble is so difficult.🙈
@leyshonrr
@leyshonrr Жыл бұрын
Dan, I have been at pains with OOP in python & R for many years. Your video series here is honestly some of the most tangible and comprehensible learning material I've come across for this programming paradigm.
@itsMapleLeaf
@itsMapleLeaf 6 жыл бұрын
i pretty much know most if not all of this stuff, but it's still fun to watch Dan talk about it :D
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
hah
@pieteroehlers9716
@pieteroehlers9716 6 жыл бұрын
Is this ES6 only if you have p5.js or is is just something in js
@pieteroehlers9716
@pieteroehlers9716 6 жыл бұрын
Is this ES6 only if you have p5.js or is is just something in js
@abdoelkaheal1940
@abdoelkaheal1940 6 жыл бұрын
this is something in js
@muhammedmustafa5725
@muhammedmustafa5725 3 жыл бұрын
I feel so bad as I have just found your channel now, and I haven’t seen this video for 2 years. You are by far the best teacher I have seen
@greatsuccess4734
@greatsuccess4734 4 жыл бұрын
Coding in Javascript for 2 years now, have watched tons of videos where has this guy been hiding all the time. damn amazing tutorial.
@bahaatamer1245
@bahaatamer1245 6 жыл бұрын
I just found out about this tutor by co-incidence when I was searching for online videos to explain classes, and he is really brilliant to make things fun and easy!
@viveksakpal3231
@viveksakpal3231 6 жыл бұрын
One of the best teaching skill i have ever seen...great job
@seeker4570
@seeker4570 5 жыл бұрын
Very well done, good example of JS and OOP. "this. is the bane of your existence now", so true.
@gabrielcoku5774
@gabrielcoku5774 4 жыл бұрын
You are fun and amazing. You realise later that you actually didn't struggle at all to understand what ever He was teaching about.
@andrelie7760
@andrelie7760 3 жыл бұрын
"What does it mean to be a bubble?" You just won me over, love the energy, love the way you talk, you're gonna teach me how to create classes, and everything else
@AJBatac
@AJBatac 2 жыл бұрын
I wish my teachers in the past are 1/100th of your enthusiasm.
@DesignDensity
@DesignDensity 2 жыл бұрын
So much energy, so much motivation, when I watch your videos I get 1000% more inspired and motivated to do things in writing codes than just watching... You are remarkable :)
@jacob9919
@jacob9919 4 жыл бұрын
Please tell me you teach for a living, you've got the perfect spirit for it. This helped me so much trying to refresh my brain after my break from my curriculum. Thanks so much!
@Vendavalez
@Vendavalez 5 жыл бұрын
"There are 15 different ways to do everything in JavaScript and also this video will be out of date by the time you watch it because there will be a new way which peopel are doing now, I am just trying to keep with the times." Me too train man. Me too.
@neotericphoenix5811
@neotericphoenix5811 6 жыл бұрын
WTF! New favorite teacher!
@heidik1757
@heidik1757 4 жыл бұрын
The reason I enjoy learning p5 is because it allows me to visually see JS in action and how all the different parts (loops, conditionals, etc.) translate visually. I think this will help me to apply JS to less visual applications when the time comes. I also think he's hilarious. Great teacher.
@fotiem.constant4948
@fotiem.constant4948 2 жыл бұрын
This guy is a genius. It's been 3 years now and your video is still very relevant. Thanks for making my understanding of OOP easier sir.
@jostermayer
@jostermayer 5 жыл бұрын
I watched hundreds of programming videos had six years of programming in school and your videos is the first thing where I really understand coding
@santiagoramirez5507
@santiagoramirez5507 3 жыл бұрын
The best coding teacher on KZbin ever!!! Regards from Chile!
@Juliazevallos-vn5vw
@Juliazevallos-vn5vw Жыл бұрын
You explain things so easy. Other videos take you directly to the coding aspect and its hard to understand the why and how. Thank you for being so clear and detailed in your explanations.
@puneetjain5625
@puneetjain5625 3 жыл бұрын
Worked in oop for some time, still all this create a new meaning for me. I always learn coming back to you. You have changed my approach to programming.
@martynconkling8876
@martynconkling8876 2 жыл бұрын
Such an excellent introductory video to classes! I use this video in my classes and have been referring people to this playlist for years!
@gary3548
@gary3548 4 жыл бұрын
Finally a programming tutorial, where the presenter has passion and makes you not fall asleep! thanks!
@user-cy3kn7zx1l
@user-cy3kn7zx1l 4 жыл бұрын
You add so much flavor and spice into teaching that it's very fun to learn and follow along! Awesome work dude!
@Kasas90
@Kasas90 3 жыл бұрын
Sir you got my attenction within the first 10 seconds. What an amazing format did you choose. You nailed it.
@Killjoy3990
@Killjoy3990 6 жыл бұрын
OH MAN this is what I needed. I needed it laid out for me exactly like this.
@maarten452
@maarten452 5 жыл бұрын
Note that classes always start with a Capital letter.
@mirzaaghaalikhan183
@mirzaaghaalikhan183 3 жыл бұрын
Isnt that just a convention?
@VivekYadav-ds8oz
@VivekYadav-ds8oz 3 жыл бұрын
@@mirzaaghaalikhan183 Yes, but one that would help a lot if followed thoroughly.
@1inda1ee
@1inda1ee Жыл бұрын
I really love your videos because I'm currenty working as a web developer and everytime I get to use, I just didn't know how to do it properly. Anyhow, I totally understands and can do class function with confidence. Thank you ~
@thomasalston
@thomasalston 5 жыл бұрын
Dude, you have a very unique method of teaching! Thank you for going into such detail and the repetition, it was very helpful.
@ahmedsellami1743
@ahmedsellami1743 5 жыл бұрын
I think You are the best teacher in programming. I didn't understand classes before but now thank You !!!
@vasilispapasakellariou4074
@vasilispapasakellariou4074 3 жыл бұрын
I have reached a point where i am coming in ur channel just to have fun and chill listening to u ! Duuuuude.
@makitocode
@makitocode 4 жыл бұрын
One of the best videos to explain objects in JS. Excellent work with these videos, really really helpful!
@thanos4177
@thanos4177 4 жыл бұрын
Happy Teachers' Day :) Thank you, you made coding a lot easier to me!
@baxudak
@baxudak 3 жыл бұрын
dude, even tho it's already 3 years old, i'm amazed by your explanation skills! thank you for helping me understand classes :D
@StrengthScholar0
@StrengthScholar0 3 жыл бұрын
Thank you so much I'm in a coding bootcamp and I was completely lost on classes and constructors until this video. You saved my ass
@theriddler525
@theriddler525 3 жыл бұрын
I have taken classes on this stuff and not understood it. Thank you for describing these concepts in a way that finally let me understand them!
@gemma4784
@gemma4784 3 жыл бұрын
these videos are getting me through my 'programming for visual artists' class........ i love this man
@mrwrench3131
@mrwrench3131 2 жыл бұрын
"this dot is the bane of your existence now, welcome to your life" I felt that on a personal level :)
@knowledge_4203
@knowledge_4203 3 жыл бұрын
I ABSOLUTELY LOVE how he teaches. I am definitely SUBSCRIBING!
@drivgest
@drivgest 6 жыл бұрын
always loved the way you write codes. so clean and efficient.....
@stevetran1215
@stevetran1215 5 жыл бұрын
This tutorial is exhilarating, helpful and impressive! Thank you!
@m.pashakhoshkebari2045
@m.pashakhoshkebari2045 3 жыл бұрын
The first time I watched this, I understood nothing and was super confused. The next day, I went back on it and decided that I was going to try my hardest to try to learn again. By the time it was finished, I had understood everything and realized that no KZbinr or teacher will ever be able to teach like this man can. You truly are the goat :)
@racheltodd5424
@racheltodd5424 3 жыл бұрын
Same experience dude. I love coding but I've put it off for a few months because i need to write college essays (I REALLY REALLY hate them). But I'm rewatching a lot of this man's videos in an attempt to make bootleg versions of my fav 2d games
@JatanPassi
@JatanPassi 2 жыл бұрын
@@racheltodd5424 Hey there person so did you make that game yet or what?
@racheltodd5424
@racheltodd5424 2 жыл бұрын
@@JatanPassi sort of. I made a pong game and then got held up w life. But I'm in college for cs now so I should be making bigger and better things
@J3SUZFR33K
@J3SUZFR33K Жыл бұрын
Bro! You are the man! You can teach the world my friend! I love your enthusiasm, charisma, and passion! Keep it up Boss man!
@darkhorse621
@darkhorse621 3 жыл бұрын
"What does it mean to be a human?" This statement was the aha moment for me in understanding Objects and Classes. Thank you so much !!!
@sultanehind5884
@sultanehind5884 3 жыл бұрын
Its 2020 and I came here watching all the videos from the start of the series... sir but you said it might be outdated when I watch it... it kind of got me worried there. But still I am going to finish the course, hope it will help me grasp the ml5 playlist easily!! BTW sir you are the most amazing professor I ever saw in my life. God may bless you with long life!
@DanielHernandez-jn8lz
@DanielHernandez-jn8lz Жыл бұрын
What a great way to explain something that usually is boring and abstract and turn it to something very easy and funny... I'm learning JS and I will watch all your videos!!!!
@akshhatsrivastava1972
@akshhatsrivastava1972 4 жыл бұрын
Thank you so much for this great explanation! "What it means to be a bubble?" really made me understand constructors and classes.
@abdessadekelaasri8862
@abdessadekelaasri8862 Жыл бұрын
I just open youtube sometimes and pick a random video from your playlist and watch, It's so fun and very educational. Thank you teacher :)
@24Leonberger
@24Leonberger 5 жыл бұрын
Really enjoy this tutorial video you make learning fun! Thank you!
@bernardnoctor5627
@bernardnoctor5627 3 жыл бұрын
i agree he is funny as long he uses his bell
@ryanscoville3586
@ryanscoville3586 2 жыл бұрын
Thank you for being the kind of teacher that you are! I learn a ton and laugh a lot all the while. Keep it up!!!
@hnariman_
@hnariman_ 4 жыл бұрын
Tutorial is really fun to watch, especially when you're learning more complicated concepts of OOP. It will be pretty beneficial to have links on other tutorials, where let/var explained as example. Personally I get confused only at the stage where print() replaced console.log() and started watching from this particular tutorial I get confused, whether print() is custom function, node.js function or a new feature brought by ES6. But anyway, tutorial is fun and thanks for explanations!
@hugoandrade8691
@hugoandrade8691 4 жыл бұрын
what a perfect teacher, i started to love coding, because i started to watch his classes. : 3
@MarcelaoVMS
@MarcelaoVMS 5 жыл бұрын
This is so nice and fun to watch! Amazing class! Thank you very much!
@RyanValizan
@RyanValizan 3 жыл бұрын
Your statement at ~4:50 is just too true! There is no one single method to solving a problem in programming.
@cloretteangel
@cloretteangel 5 жыл бұрын
You’re a great teacher! I really understand a lot from here. :D its really cute using the bubble explanation 😁
@iqrasuhail3516
@iqrasuhail3516 2 жыл бұрын
I finally understand what the “this” keyword is used for when referring to objects. So thank you!
@shadowbro8522
@shadowbro8522 6 жыл бұрын
Love you. You make everything very easy and it feels like watching a comedy show.
@sajeevanfuels1980
@sajeevanfuels1980 3 жыл бұрын
Man you are just so talented and such such amazing teacher and ofcourse a marvellous coder!
@nostalgicnow6001
@nostalgicnow6001 Жыл бұрын
I can watch him all day. I love your style of teaching
@somalibeebs6092
@somalibeebs6092 4 жыл бұрын
thanks for all that energy you releasing just to teach us javascript. most teachers are not so energetic.
@yashchauhan5710
@yashchauhan5710 5 жыл бұрын
love the way you teach ...... really nice all those concepts goes straight inside
@waltercisneros9535
@waltercisneros9535 4 жыл бұрын
New to javascript and i've been using console.log(); for print(); stuff... what a time to be alive
@volhash3605
@volhash3605 5 жыл бұрын
OMG! Thank you SOOO much for the video! You explained it so well!
@faribadadko5694
@faribadadko5694 3 жыл бұрын
You are awesome!! I'm advertising your video all over my coding cohort! Thank you!
@FaLkraydz
@FaLkraydz 4 жыл бұрын
Thank you very much, you helped me so much about classes and promises, trying to understand both together is not easy.
@MubarkAlKhatlan
@MubarkAlKhatlan Жыл бұрын
The reason why I changed my major from computer science to Mathematics back in 2009 is recursive function and classes with a very bad teacher. Watching your videos made it looks easy. You are a good teacher, Sir.
@davidrobertson5996
@davidrobertson5996 4 жыл бұрын
Really good introductory explanation of classes, thanks Dan.
@bartomiejsadecki8309
@bartomiejsadecki8309 3 жыл бұрын
You've got so much charisma dude! Thanks for this video!
@siten1
@siten1 6 ай бұрын
I love you sense of humor; subscribed and thank you!
@helliandrosoutohenrique8931
@helliandrosoutohenrique8931 3 жыл бұрын
I'm really enjoying your teachings. Thank you!
@WeirdStuffaaaa
@WeirdStuffaaaa 2 жыл бұрын
best coding teacher i ever had
@ndukwearmstrong
@ndukwearmstrong 4 жыл бұрын
Code Train is great, hes rilli intelligent. Makes the most complex things a piece of cake
@baumian.
@baumian. 5 жыл бұрын
You're honestly just such a good teacher. Your humor is just great and you're explaining everything really well. Thank you! EDIT: Thanks for the heart
@whatsnewnow4469
@whatsnewnow4469 3 жыл бұрын
thanks you gave the actual idea what does class does thankssssssss a lot. i liked your enthusiasm throughout the video.
@arshamazami159
@arshamazami159 3 жыл бұрын
The best explanation for classes and oop programming thank you mr shiffman for your efforts 👌
@eoin4150
@eoin4150 4 жыл бұрын
Excellent video, only decent content I could find on this stuff! Thanks.
@namansharma4669
@namansharma4669 3 жыл бұрын
I am so thankful I found this video, this person and his bubbles
@kamoroso94
@kamoroso94 6 жыл бұрын
I think you did a great job at explaining the role of the `this` keyword in a class! I just wanted to respond to something you said around 12:38 about where you can define the class. You should define the class before you instantiate it. If you tried to create an instance of a class in the global scope above the class definition, it wouldn't work, so the class should be defined before the rest of your code runs, generally.
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Thanks for this tip!
@alwaysloud-zs1ce
@alwaysloud-zs1ce 2 жыл бұрын
mad scientist's vibes 🖤 love it, thanks for the video series!!!!!!!!
@Karlponken
@Karlponken 5 жыл бұрын
Great explanation, always had a hard time understanding classes and their uses. Much appreciated!
@bernardnoctor5627
@bernardnoctor5627 3 жыл бұрын
why is it you have icebergs in summer time is it because ice melts in summer?
@Karlponken
@Karlponken 3 жыл бұрын
@@bernardnoctor5627 What? 😄
@snimerjotsingh5561
@snimerjotsingh5561 4 жыл бұрын
watching in 2020 , it is really helpful ,watching the full playlist from the start so didn't understand first time and now it is clear . please arrange your youtube page so we can find every video clearly thank you soooo much !!!!!! I wish you were my professer and also i am very young 12 years
@mumuhKUH
@mumuhKUH 6 жыл бұрын
I always love your "meta-comments" about the video itself.
@desmondkrummeck5953
@desmondkrummeck5953 5 жыл бұрын
Good Fun to watch and helped me to make sense of Class, thank you.
@SharonKerenTLV
@SharonKerenTLV 4 жыл бұрын
Excellent, as always, you are a very very very good teacher!!!
@kingsolomon_fitness
@kingsolomon_fitness 4 жыл бұрын
Your explanations are crazy beautiful bro!
@jahelsantiago
@jahelsantiago 5 жыл бұрын
you and julioprofe are the best teachers in all internet
@marklong721
@marklong721 4 жыл бұрын
What a teaching! What a teacher
@j653vup
@j653vup 2 жыл бұрын
Love the energy, the white board and the explanation
@Nostradamus21b
@Nostradamus21b 4 жыл бұрын
This guy is a GENIUS. Greetings from CHILE.
@CaptainSchlockler
@CaptainSchlockler 6 жыл бұрын
You're actually quite a good lecturer
@empathy9963
@empathy9963 5 ай бұрын
All of your work is so impressive.
@muhammadsafiullah8428
@muhammadsafiullah8428 5 жыл бұрын
I paused the video just to comment that you are awesome. I love you ♥♥♥♥
@wdwdHenry9022
@wdwdHenry9022 3 жыл бұрын
If you were my teacher back in school I would now have been a much better version of my self
@josepena-bk8wd
@josepena-bk8wd 4 жыл бұрын
You are a genius , philosofy and Programming are connected
@ChongHwi
@ChongHwi 2 жыл бұрын
Short and sweet, thanks for the great video
6.3: Constructor Arguments with Classes in JavaScript - p5.js Tutorial
7:50
Coding Challenge 166: ASCII Text Images
22:42
The Coding Train
Рет қаралды 1,1 МЛН
когда достали одноклассники!
00:49
БРУНО
Рет қаралды 3,9 МЛН
ПАРАЗИТОВ МНОГО, НО ОН ОДИН!❤❤❤
01:00
Chapitosiki
Рет қаралды 2,7 МЛН
Functions vs Classes: When to Use Which and Why?
10:49
ArjanCodes
Рет қаралды 139 М.
STOP Using Classes In JavaScript | Prime Reacts
14:02
ThePrimeTime
Рет қаралды 217 М.
Generative Machines with Matt DesLauriers
39:16
fitcevents
Рет қаралды 87 М.
Ditch your Favorite Programming Paradigm
6:08
Code Persist
Рет қаралды 148 М.
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 747 М.
16.3: ES6 Arrow Function - Topics of JavaScript/ES6
22:32
The Coding Train
Рет қаралды 271 М.
Object-Oriented Programming is Bad
44:35
Brian Will
Рет қаралды 2,3 МЛН
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
How to Rotate Shapes in p5.js (translate, rotate, push, pop)
22:55
The Coding Train
Рет қаралды 197 М.
What was Coding like 40 years ago?
29:05
The Coding Train
Рет қаралды 1,6 МЛН