6.3: Constructor Arguments with Classes in JavaScript - p5.js Tutorial

6.3: Constructor Arguments with Classes in JavaScript - p5.js Tutorial

The Coding Train

6 лет назад

150,946 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@luciasance1262
@luciasance1262 - 26.11.2023 11:38

what is the difference between a class and a creating your own normal function (like in video 5.2)?

Ответить
@asy42699
@asy42699 - 16.08.2023 16:34

i tried taking that bouncing ball example and making it as a class but everytime i add if statements the ball doesnt move

Ответить
@stmp1631
@stmp1631 - 01.12.2022 18:23

hi! could anyone help me out adding perlin noise to these moving bubbles?
thnx!

Ответить
@creepychris420
@creepychris420 - 04.11.2022 22:19

all these years later i still dont know if i like the class keyword or not 😂

Ответить
@ChongHwi
@ChongHwi - 16.06.2022 18:12

Thank you

Ответить
@T25de
@T25de - 21.04.2022 21:45

Love your teaching style, enthusiastic and organic very good sir

Ответить
@vjesse2557
@vjesse2557 - 06.02.2022 00:21

Hi, I am still not understand what is "this." for and why we need use "this."? Please explain. :)

Ответить
@apoorvaadarsh1284
@apoorvaadarsh1284 - 24.10.2021 05:30

I loved it, it cleared most of my doubts , thank you very much 😊

Ответить
@awara6984
@awara6984 - 18.09.2021 17:09

thank you

Ответить
@vegasvato55
@vegasvato55 - 01.07.2021 19:19

ONCE THE CLASS CONSTRUCTOR IS CALLED AND CREATES THE NEW OBJECT, HOW DO I GET THE NEW OBJECT INTO AN OBJECT ARRAY???
HOW DO I GET A NEW PERSON OBJECT FROM THE NEW PERSON CONSTRUCTUR INTO THE PERSONS ARRAY???

Ответить
@matthewman249
@matthewman249 - 01.07.2021 04:17

I'm here because I'm trying to use Class/constructors to form a new object every second in setInterval... hoping I figure it out soon.

Ответить
@ahmedr.
@ahmedr. - 18.05.2021 05:30

Here is the video where the fun begins . Wohoo

Ответить
@buzzz241
@buzzz241 - 28.03.2021 15:10

Can you have more than 1 constructor? Does JavaScript recognize constructor “signature”?

Ответить
@faraznisar3752
@faraznisar3752 - 05.02.2021 10:24

please put out a full-on course for javascript or whatever you would. My life would be much easier.

Ответить
@jaishree4490
@jaishree4490 - 08.01.2021 16:46

thank you so much.... now i fully understand constructor

Ответить
@anacosta5447
@anacosta5447 - 21.12.2020 13:43

You ruined me! After watching your videos I can't get anything out of those other monotone lessons. Guess I'll have to go back to books now. Thanks a million!

Ответить
@jimhalpert9803
@jimhalpert9803 - 07.11.2020 13:50

This guy never fails to impress with his amazing teaching skills.

Ответить
@kaustavbasu
@kaustavbasu - 22.10.2020 23:35

thanks for creating such amazing tutorials. :)

Ответить
@siyadeveloper
@siyadeveloper - 14.10.2020 07:55

can I pass a function name as an argument through a constructor?

Ответить
@maxzou6642
@maxzou6642 - 28.07.2020 06:14

To bubble or not to bubble, that is the bubble.

Ответить
@pepefubias7654
@pepefubias7654 - 26.07.2020 02:09

great bubble

Ответить
@soolee9720
@soolee9720 - 16.07.2020 03:40

Thank you! Your video is really helpful ! Is that possible to shorten code “bubble1.make()~bubble2.show()”??

Ответить
@shauryaveerchaudhry2163
@shauryaveerchaudhry2163 - 08.07.2020 14:48

The need of the hour in this cruel-cruel world is to know the answer to one question. One question that is the bane of our existence and will decide our future: What does it mean to be a bubble???

Ответить
@brownboyem5002
@brownboyem5002 - 01.07.2020 21:35

Finally this makes sense. Thanks

Ответить
@abrafgesvbeac3676
@abrafgesvbeac3676 - 06.06.2020 22:30

Thank you so much!

Ответить
@RasamRostami
@RasamRostami - 26.03.2020 11:50

One issue here, I wanted to see your code for this video but didn't find it in the Git link you mentioned in the description. Maybe I don't know how to use Git yet (because I'm new to programming and only watched this playlist so far).

Ответить
@johnjohnson4484
@johnjohnson4484 - 02.12.2019 02:52

dawg, you totally demystified oop here.

Ответить
@avinashmahawar2124
@avinashmahawar2124 - 28.11.2019 06:57

ohh man!!! how you do it....this is an awesome video....actually the whole playlist is awesome....

Ответить
@obreaker8993
@obreaker8993 - 28.09.2019 05:33

I love this guys' sense of humor

Ответить
@barty200yt6
@barty200yt6 - 29.08.2019 12:27

I already knew most of this stuff from your coding challenges but it's still fun watching everything and getting a explanation on how everything works

Ответить
@basiccoder2166
@basiccoder2166 - 14.08.2019 19:09

Thank you for explaining in fun way Daniel.

Ответить
@brentstonehill8672
@brentstonehill8672 - 30.07.2019 03:21

LMAO, great obscure reference. Pink Fluffy Unicorns Dancing on Rainbows (by Songs to Wear Pants To)

Ответить
@ViratKohli-jj3wj
@ViratKohli-jj3wj - 17.07.2019 13:06

I know these constructors, In python we use __init__ function

Ответить
@03ashubham1
@03ashubham1 - 09.07.2019 10:27

Javascript just likes to work :)

Ответить
@Kaxlon
@Kaxlon - 10.06.2019 01:03

Don't get me wrong now, but...
To me, as a old assembly coder this Object Oriented stuff grinds my gears sometimes. I know this OOP is the future and so on.
But sometimes I feel like I'm building a complete circus event including the town it's visiting, paving roads that leads to the town, setup signs, etc.
All this for some circus clowns doing tricks and blowing soap bubbles and having fun.
But the circus is empty. There are no people watching. No people live in the town. No one has, no one will.
But hey these 3-4 circus clowns needs all this to function. Right?
Actually not at all.
For me the old bitter assembly coder all this seems like madness.
In OOP we setup for a space launch when in fact we're just going down to the corner shop to get a pack of milk.
Insanity I say! =)
The dusty bitter old assembler coder just makes a few short arrays and a loop to execute the damn thing. Done! Profit.

I enjoy OOP as much as the next coder. But we all really know why we need GigaJohns of memory in our PC's. But we don't talk about it. ;)
LoL Loading library after library just to use 1 or 2 things in it. Madness I say!

Keep up the great work Daniel! Love your videos. =)

PS. My comment was sarcasm. I hope everyone understood that.

Ответить
@josephsearle9513
@josephsearle9513 - 16.05.2019 10:50

quick question. can you put loops and if statements inside classes?

Ответить
@kevinfriedman6766
@kevinfriedman6766 - 21.04.2019 18:02

These videos are so well done! One thing I don’t think you mentioned though was the idea of hoisting within class declaration vs function declaration. The difference is that class declarations are NOT hoisted. So, if you didn’t declare your bubble variables at the top, since your class is written below the new Bubble instance, technically you’d see errors. I think this is a very important concept to understand with classes! Thanks for making all these videos, I watch them daily!

Ответить
@subarashi617
@subarashi617 - 05.02.2019 10:51

isn't there any video about getters and setters.?

Ответить
@AJ-gg1jc
@AJ-gg1jc - 07.01.2019 11:49

let c = new car(100,200,100);

function setup()
{
createCanvas(500,300);
background(100,190,255);
}

function draw()
{
c.rectangle(200,100,100);
}

class car
{
constructor(x,y,w)
{
this.x=x;
this.y=y;
this.w=w;
}
rectangle(x,y,w)
{
rect(this.x,this.y,this.w+50,this.w);
ellipse(this.x+20,this.y+50,20);
ellipse(this.x+70,this.y+50,20);
}
}

//this is not working....please help

Ответить
@samhenden
@samhenden - 19.12.2018 01:25

I keep getting the error Uncaught ReferenceError: Bubble1 is not defined (sketch: line 6) but cant find what the problem is, im pretty sure I have copied the code exactly, after trying my own variation and also getting this error. This is all new to me, but does anyone in the comments have any suggestions?

Ответить
@PoboyMusic
@PoboyMusic - 01.12.2018 05:48

I finally understand classes. Thanks

Ответить