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

description
This video introduces Object-Oriented Programming in JavaScript with ES6 classes and the p5.js library. Code: https://thecodingtrain.com/tracks/code-programming-with-p5-js/code/6-objects/2-classes πŸ•ΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/qi7N4LWq πŸŽ₯ Previous video: https://youtu.be/xG2Vbnv0wvg?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA πŸŽ₯ Next video: https://youtu.be/rHiSsgFRgx4?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA 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: http://thecodingtrain.com/ πŸ‘Ύ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide 🚩 Suggest Topics: https://github.com/CodingTrain/Suggestion-Box πŸ’‘ GitHub: https://github.com/CodingTrain πŸ’¬ Discord: https://discord.gg/hPuGy2g πŸ’– Membership: http://youtube.com/thecodingtrain/join πŸ›’ Store: https://standard.tv/codingtrain πŸ–‹οΈ Twitter: https://twitter.com/thecodingtrain πŸ“Έ Instagram: https://www.instagram.com/the.coding.train/ πŸŽ₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH πŸŽ₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA πŸ”— p5.js: https://p5js.org πŸ”— p5.js Web Editor: https://editor.p5js.org/ πŸ”— Processing: https://processing.org πŸ“„ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new #basics #oop #objects #p5js #javascript

detail
{'title': '6.2: Classes in JavaScript with ES6 - p5.js Tutorial', 'heatmap': [{'end': 813.388, 'start': 781.474, 'weight': 1}, {'end': 1089.672, 'start': 1063.561, 'weight': 0.784}], 'summary': 'This tutorial series covers the introduction to object-oriented programming in javascript, emphasizing the use of classes for code organization, discussing object-oriented programming principles such as encapsulation, code modularity, and reusability, and delving into javascript constructors, objects, and class setup, with a focus on the bubble object utilizing x and y coordinates.', 'chapters': [{'end': 86.757, 'segs': [{'end': 46.97, 'src': 'embed', 'start': 1.189, 'weight': 0, 'content': [{'end': 3.491, 'text': 'Hello This is a very exciting moment for me.', 'start': 1.189, 'duration': 2.302}, {'end': 5.533, 'text': "I don't know if this is an exciting moment for you.", 'start': 3.812, 'duration': 1.721}, {'end': 15.023, 'text': 'This is the video where I am going to talk about object-oriented programming in JavaScript, using something called classes,', 'start': 6.715, 'duration': 8.308}, {'end': 17.625, 'text': 'for the very first time ever in any of my videos.', 'start': 15.023, 'duration': 2.602}, {'end': 20.108, 'text': 'So this video is part of a playlist.', 'start': 18.306, 'duration': 1.802}, {'end': 23.111, 'text': "And if you're watching that playlist, what you just learned about is functions.", 'start': 20.148, 'duration': 2.963}, {'end': 28.355, 'text': 'done something where you first use functions to reorganize your code.', 'start': 25.333, 'duration': 3.022}, {'end': 32.357, 'text': 'And you said, OK, I have some code which draws a circle.', 'start': 28.395, 'duration': 3.962}, {'end': 35.501, 'text': 'And I have some code which moves a circle.', 'start': 32.698, 'duration': 2.803}, {'end': 40.124, 'text': "So I'm changing some xy variables and drawing an ellipse at some xy variables.", 'start': 35.681, 'duration': 4.443}, {'end': 45.569, 'text': 'And then I put those into these own functions, call them display, call them move, and I can call them and draw.', 'start': 40.385, 'duration': 5.184}, {'end': 46.97, 'text': "So I've organized my code.", 'start': 45.609, 'duration': 1.361}], 'summary': 'Introduction to object-oriented programming in javascript using classes for the first time, part of a playlist on functions.', 'duration': 45.781, 'max_score': 1.189, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w1189.jpg'}, {'end': 104.414, 'src': 'embed', 'start': 70.943, 'weight': 2, 'content': [{'end': 72.705, 'text': 'And there are reasons why you might want to do that.', 'start': 70.943, 'duration': 1.762}, {'end': 77.669, 'text': "And you're going to see those in many future videos, just sort of standalone functions that exist unto themselves.", 'start': 72.725, 'duration': 4.944}, {'end': 83.034, 'text': 'And in fact, there is a style of programming called functional programming, which JavaScript is well suited for,', 'start': 77.709, 'duration': 5.325}, {'end': 86.757, 'text': 'because functions are kind of like the core building block of JavaScript.', 'start': 83.034, 'duration': 3.723}, {'end': 89.74, 'text': 'But I am going to take a different direction here.', 'start': 86.837, 'duration': 2.903}, {'end': 98.108, 'text': 'Because, in particular, if what I want to do is program graphics, simulations, animations, things moving around the screen,', 'start': 90.14, 'duration': 7.968}, {'end': 104.414, 'text': 'one way to do that is to think about this circle moving around as an object.', 'start': 98.108, 'duration': 6.306}], 'summary': 'Javascript is well-suited for functional programming due to its core building block of functions, but the focus here is on using objects for graphics, simulations, and animations.', 'duration': 33.471, 'max_score': 70.943, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w70943.jpg'}], 'start': 1.189, 'title': 'Introduction to object-oriented programming', 'summary': 'Introduces the concept of using classes for object-oriented programming in javascript, following a discussion on the reorganization of code using functions and the significance of functions as the core building block of javascript.', 'chapters': [{'end': 86.757, 'start': 1.189, 'title': 'Introduction to object-oriented programming in javascript', 'summary': 'Introduces the concept of using classes for object-oriented programming in javascript, following a discussion on the reorganization of code using functions and the significance of functions as the core building block of javascript.', 'duration': 85.568, 'highlights': ['The video introduces object-oriented programming in JavaScript, specifically using classes for the first time, as part of a playlist that initially covers functions.', 'The reorganization of code using functions is highlighted, where code for drawing and moving a circle is encapsulated into separate functions, emphasizing the organization of code.', 'The significance of functions as core building blocks of JavaScript is discussed, with reference to the suitability of JavaScript for functional programming.']}], 'duration': 85.568, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w1189.jpg', 'highlights': ['The video introduces object-oriented programming in JavaScript, specifically using classes for the first time, as part of a playlist that initially covers functions.', 'The reorganization of code using functions is highlighted, where code for drawing and moving a circle is encapsulated into separate functions, emphasizing the organization of code.', 'The significance of functions as core building blocks of JavaScript is discussed, with reference to the suitability of JavaScript for functional programming.']}, {'end': 440.903, 'segs': [{'end': 114.144, 'src': 'embed', 'start': 86.837, 'weight': 1, 'content': [{'end': 89.74, 'text': 'But I am going to take a different direction here.', 'start': 86.837, 'duration': 2.903}, {'end': 98.108, 'text': 'Because, in particular, if what I want to do is program graphics, simulations, animations, things moving around the screen,', 'start': 90.14, 'duration': 7.968}, {'end': 104.414, 'text': 'one way to do that is to think about this circle moving around as an object.', 'start': 98.108, 'duration': 6.306}, {'end': 106.737, 'text': "Now, I'm already thinking about it as an object.", 'start': 104.475, 'duration': 2.262}, {'end': 107.417, 'text': "It's a bubble.", 'start': 106.837, 'duration': 0.58}, {'end': 109.66, 'text': "It's got an x and a y.", 'start': 108.078, 'duration': 1.582}, {'end': 110.661, 'text': 'It has data.', 'start': 109.66, 'duration': 1.001}, {'end': 114.144, 'text': 'But I want to think about it as having functionality.', 'start': 111.221, 'duration': 2.923}], 'summary': 'Using object-oriented approach for programming graphics and simulations.', 'duration': 27.307, 'max_score': 86.837, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w86837.jpg'}, {'end': 207.367, 'src': 'embed', 'start': 179.017, 'weight': 2, 'content': [{'end': 181.858, 'text': 'You can make your code modular, or you can make your code reusable.', 'start': 179.017, 'duration': 2.841}, {'end': 184.259, 'text': 'This is also true of object-oriented programming.', 'start': 182.318, 'duration': 1.941}, {'end': 189.54, 'text': 'But one of the first key principles of object-oriented programming is this idea of encapsulation.', 'start': 184.279, 'duration': 5.261}, {'end': 198.944, 'text': 'I want to encapsulate everything that it is to be a certain thing inside of an object.', 'start': 191.181, 'duration': 7.763}, {'end': 201.625, 'text': 'What does it mean to be a bubble?', 'start': 199.524, 'duration': 2.101}, {'end': 203.946, 'text': 'What do bubbles have?', 'start': 201.985, 'duration': 1.961}, {'end': 205.486, 'text': 'What properties do they have?', 'start': 204.306, 'duration': 1.18}, {'end': 207.367, 'text': 'What things do they do throughout their life?', 'start': 205.546, 'duration': 1.821}], 'summary': 'Encapsulation is a key principle of object-oriented programming, encapsulating all aspects of an object within it.', 'duration': 28.35, 'max_score': 179.017, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w179017.jpg'}, {'end': 375.125, 'src': 'embed', 'start': 345.556, 'weight': 0, 'content': [{'end': 347.298, 'text': "But I'm just trying to keep up with the times.", 'start': 345.556, 'duration': 1.742}, {'end': 350.101, 'text': 'And I think classes are a nice way.', 'start': 347.779, 'duration': 2.322}, {'end': 353.345, 'text': "They're a way that I am now choosing to create objects in JavaScript.", 'start': 350.121, 'duration': 3.224}, {'end': 354.586, 'text': 'So let me come back over here.', 'start': 353.605, 'duration': 0.981}, {'end': 359.721, 'text': 'A class is the idea of the template.', 'start': 355.62, 'duration': 4.101}, {'end': 360.541, 'text': 'This is the template.', 'start': 359.761, 'duration': 0.78}, {'end': 368.123, 'text': 'You can think of this as a bit of a, this is not my invention here, but one way of thinking about this is the class is the cookie cutter.', 'start': 360.561, 'duration': 7.562}, {'end': 373.324, 'text': 'The object itself, this is the object also often referred to as an instance.', 'start': 368.983, 'duration': 4.341}, {'end': 375.125, 'text': 'This is the thing itself.', 'start': 373.845, 'duration': 1.28}], 'summary': 'Learning javascript classes to create objects and templates.', 'duration': 29.569, 'max_score': 345.556, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w345556.jpg'}], 'start': 86.837, 'title': 'Object-oriented programming principles', 'summary': 'Explains object-oriented programming principles, emphasizing encapsulation, and class usage for code modularity and reusability in javascript.', 'chapters': [{'end': 159.237, 'start': 86.837, 'title': 'Object-oriented programming for graphics', 'summary': 'Discusses the concept of treating graphics as objects with functionality, aiming to write code to create objects and issue commands on them for dynamic and interactive screen movements.', 'duration': 72.4, 'highlights': ['The chapter emphasizes the concept of treating graphics as objects with functionality, such as moving and displaying, and aims to write code to create objects and issue commands on them for dynamic and interactive screen movements.', 'It mentions the need to think about the graphics as having functionality, such as the ability to move and be displayed, and the desire to issue commands on these objects for dynamic screen movements.', 'The speaker expresses the intention to write code where objects are created and commands are issued on them, emphasizing the importance of treating graphics as objects with functionality.']}, {'end': 440.903, 'start': 159.237, 'title': 'Object-oriented programming principles', 'summary': 'Explains the principles of object-oriented programming, emphasizing encapsulation as a key principle and the use of classes to define object templates, promoting code modularity and reusability in javascript.', 'duration': 281.666, 'highlights': ['Encapsulation is a key principle of object-oriented programming, where everything that defines a certain object is encapsulated within a class or template. Encapsulation is emphasized as a key principle of object-oriented programming, ensuring that all attributes and behaviors of an object are encapsulated within a class or template, promoting modularity and reusability.', 'The use of classes in JavaScript allows for the encapsulation of all properties and functionalities of objects, promoting code modularity and reusability. The use of classes in JavaScript enables the encapsulation of object properties and functionalities, promoting code modularity and reusability by defining object templates.', 'The concept of classes in object-oriented programming is likened to a template or blueprint, emphasizing the separation of the template (class) from the actual object (instance). The concept of classes in object-oriented programming is illustrated as a template or blueprint, emphasizing the separation of the class (template) from the actual object (instance), akin to a cookie cutter and the cookies it produces.']}], 'duration': 354.066, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w86837.jpg', 'highlights': ['The use of classes in JavaScript enables the encapsulation of object properties and functionalities, promoting code modularity and reusability by defining object templates.', 'The concept of treating graphics as objects with functionality, such as moving and displaying, is emphasized, aiming to write code to create objects and issue commands on them for dynamic and interactive screen movements.', 'Encapsulation is a key principle of object-oriented programming, ensuring that all attributes and behaviors of an object are encapsulated within a class or template, promoting modularity and reusability.']}, {'end': 1195.891, 'segs': [{'end': 493.521, 'src': 'embed', 'start': 465.194, 'weight': 0, 'content': [{'end': 468.335, 'text': 'So what is the syntax of writing the actual class??', 'start': 465.194, 'duration': 3.141}, {'end': 472.077, 'text': 'What is the syntax of making actual object instances??', 'start': 469.136, 'duration': 2.941}, {'end': 473.677, 'text': 'OK, where should we start??', 'start': 472.737, 'duration': 0.94}, {'end': 479.598, 'text': 'So I keep saying that not, I keep saying, but I said before there was this new keyword called new.', 'start': 474.257, 'duration': 5.341}, {'end': 484.239, 'text': 'And what new does is it creates an object instance.', 'start': 480.279, 'duration': 3.96}, {'end': 490.841, 'text': "It says, hey, make a new instance of an object that's defined inside of a class called bubble.", 'start': 484.4, 'duration': 6.441}, {'end': 493.521, 'text': 'So I know I want to make a bubble, which is something I made up.', 'start': 491.141, 'duration': 2.38}], 'summary': "Introduction to creating object instances using the 'new' keyword.", 'duration': 28.327, 'max_score': 465.194, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w465194.jpg'}, {'end': 566.959, 'src': 'embed', 'start': 537.219, 'weight': 2, 'content': [{'end': 539.641, 'text': "It is written just like, I don't have to say function.", 'start': 537.219, 'duration': 2.422}, {'end': 541.262, 'text': 'By definition, it is a function.', 'start': 539.701, 'duration': 1.561}, {'end': 543.603, 'text': "So it's just like any old function definition.", 'start': 541.522, 'duration': 2.081}, {'end': 546.185, 'text': "It's a function definition inside the class.", 'start': 543.683, 'duration': 2.502}, {'end': 550.968, 'text': "And in here, this is kind of like the object's setup.", 'start': 546.505, 'duration': 4.463}, {'end': 554.39, 'text': 'So we think of setup and draw in our code, like in P5.', 'start': 551.388, 'duration': 3.002}, {'end': 555.771, 'text': 'Setup is where I initialize everything.', 'start': 554.431, 'duration': 1.34}, {'end': 558.773, 'text': 'Draw is where I animate stuff and loop over and over again.', 'start': 556.212, 'duration': 2.561}, {'end': 562.856, 'text': "The constructor is like the object's setup.", 'start': 559.354, 'duration': 3.502}, {'end': 566.959, 'text': "So I'm defining again, what does it mean to be a bubble? Now I'm getting more specific.", 'start': 563.136, 'duration': 3.823}], 'summary': 'The transcript explains defining a function inside a class, likening it to setup and draw in p5, and defining the constructor for a specific object.', 'duration': 29.74, 'max_score': 537.219, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w537219.jpg'}, {'end': 671.043, 'src': 'embed', 'start': 642.569, 'weight': 5, 'content': [{'end': 650.575, 'text': "And so the way that I do this, and this, I'm awkwardly saying this because the thing that I'm going to write here is actually this.", 'start': 642.569, 'duration': 8.006}, {'end': 654.926, 'text': 'This.x, this.y.', 'start': 651.804, 'duration': 3.122}, {'end': 659.448, 'text': 'This is a key word in JavaScript that can mean a lot of different things.', 'start': 655.326, 'duration': 4.122}, {'end': 663.771, 'text': 'And over time in future videos, I will use it for a variety of different purposes.', 'start': 659.528, 'duration': 4.243}, {'end': 671.043, 'text': 'But for right now, this keyword is a reference to the current object instance.', 'start': 665.202, 'duration': 5.841}], 'summary': "Javascript keyword 'this' refers to the current object instance.", 'duration': 28.474, 'max_score': 642.569, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w642569.jpg'}, {'end': 813.388, 'src': 'heatmap', 'start': 781.474, 'weight': 1, 'content': [{'end': 791.239, 'text': "And I'm just going to say print line x bubble.x bubble.y.", 'start': 781.474, 'duration': 9.765}, {'end': 796.883, 'text': "And it's not println anymore in p5, it's just print, which is the same as console.log, but that's a bit of an aside.", 'start': 791.319, 'duration': 5.564}, {'end': 801.065, 'text': "So now I'm going to run this, and I'm going to see, look at that.", 'start': 798.243, 'duration': 2.822}, {'end': 803.862, 'text': '200 comma 150.', 'start': 802.561, 'duration': 1.301}, {'end': 807.544, 'text': 'And actually one thing I can do just to kind of.', 'start': 803.862, 'duration': 3.682}, {'end': 813.388, 'text': "I can actually, in this interactive console that I'm using in Chrome, I can actually just type bubble and look and see.", 'start': 807.544, 'duration': 5.844}], 'summary': 'Using p5, the coordinates of a bubble are printed as 200, 150.', 'duration': 31.914, 'max_score': 781.474, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w781474.jpg'}, {'end': 960.165, 'src': 'embed', 'start': 935.979, 'weight': 6, 'content': [{'end': 942.644, 'text': "But inside of the template, inside of the class, I'm referring to the variables, the data that's part of a bubble object.", 'start': 935.979, 'duration': 6.665}, {'end': 947.227, 'text': 'I need to refer to it as this dot x and this dot x.', 'start': 942.884, 'duration': 4.343}, {'end': 949.088, 'text': "So let's go now add that to our program.", 'start': 947.227, 'duration': 1.861}, {'end': 953.883, 'text': "So I'm going to add a function called move.", 'start': 950.782, 'duration': 3.101}, {'end': 960.165, 'text': 'And by the way, what do I want to do in this? I want to do exactly what I did in the previous example.', 'start': 954.583, 'duration': 5.582}], 'summary': 'Referring to variables inside the template class and adding a function called move.', 'duration': 24.186, 'max_score': 935.979, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w935979.jpg'}, {'end': 1104.545, 'src': 'heatmap', 'start': 1063.561, 'weight': 3, 'content': [{'end': 1083.016, 'text': 'And then the world is your oyster to make bubble1 Bubble two, bubble one, bubble two, bubble one, move, show, bubble two, move, show.', 'start': 1063.561, 'duration': 19.455}, {'end': 1084.908, 'text': 'So look at that.', 'start': 1084.448, 'duration': 0.46}, {'end': 1086.41, 'text': 'There are now two on the screen.', 'start': 1084.948, 'duration': 1.462}, {'end': 1089.672, 'text': "And I didn't have to change anything about the class.", 'start': 1086.83, 'duration': 2.842}, {'end': 1091.774, 'text': 'The class is a generic template.', 'start': 1090.033, 'duration': 1.741}, {'end': 1095.277, 'text': 'It knows nothing about where it might be used or how it might be applied.', 'start': 1091.854, 'duration': 3.423}, {'end': 1096.558, 'text': "It's just the template.", 'start': 1095.577, 'duration': 0.981}, {'end': 1100.422, 'text': 'So this is a way of defining objects.', 'start': 1096.879, 'duration': 3.543}, {'end': 1103.604, 'text': 'And this is no good, because this works for two.', 'start': 1100.482, 'duration': 3.122}, {'end': 1104.545, 'text': "But eventually, I'm going to want to have 100.", 'start': 1103.664, 'duration': 0.881}], 'summary': 'Generic template allows easy creation of objects, scaling to 100 required.', 'duration': 55.212, 'max_score': 1063.561, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w1063561.jpg'}], 'start': 441.543, 'title': 'Javascript constructors and objects', 'summary': 'Discusses the syntax of writing classes, creating object instances using the new keyword, and defining constructors for object setup in object-oriented programming. it also explores the concept of constructors and objects in javascript, demonstrating the process of defining a class, creating a constructor, and adding functionality to the class to create multiple object instances, with a focus on the bubble object, utilizing x and y coordinates to illustrate the concept.', 'chapters': [{'end': 558.773, 'start': 441.543, 'title': 'Object-oriented programming syntax', 'summary': 'Discusses the syntax of writing classes, creating object instances using the new keyword, and defining constructors for object setup in object-oriented programming.', 'duration': 117.23, 'highlights': ['The new keyword in object-oriented programming creates an object instance, and it is used to execute a special kind of function to construct an object.', 'In object-oriented programming, a constructor needs to be written in every class to set up the object, similar to the setup function in P5 for initializing.', 'The syntax of writing classes and making object instances is crucial in understanding object-oriented programming.']}, {'end': 1195.891, 'start': 559.354, 'title': 'Understanding javascript constructors and objects', 'summary': 'Explores the concept of constructors and objects in javascript, demonstrating the process of defining a class, creating a constructor, and adding functionality to the class to create multiple object instances, with a focus on the bubble object, utilizing x and y coordinates to illustrate the concept.', 'duration': 636.537, 'highlights': ['The chapter delves into the concept of constructors and objects in JavaScript, detailing the process of defining a class, creating a constructor, and adding functionality to the class to create multiple object instances, with a focus on the bubble object.', "The instructor emphasizes the importance of declaring variables within the class to specify the data for a particular object, highlighting the significance of using 'this' as a reference to the current object instance in JavaScript.", 'The chapter illustrates the process of adding functionality to the bubble class, demonstrating the creation of a move function to change the x and y coordinates of the bubble object, and a show function to display the object on the screen.', 'The chapter discusses the generic nature of a class as a template, emphasizing its independence from specific object instances and its ability to facilitate the creation of multiple object instances with unique properties and functionality.']}], 'duration': 754.348, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/T-HGdc8L-7w/pics/T-HGdc8L-7w441543.jpg', 'highlights': ['The syntax of writing classes and making object instances is crucial in understanding object-oriented programming.', 'The new keyword in object-oriented programming creates an object instance, and it is used to execute a special kind of function to construct an object.', 'In object-oriented programming, a constructor needs to be written in every class to set up the object, similar to the setup function in P5 for initializing.', 'The chapter delves into the concept of constructors and objects in JavaScript, detailing the process of defining a class, creating a constructor, and adding functionality to the class to create multiple object instances, with a focus on the bubble object.', 'The chapter discusses the generic nature of a class as a template, emphasizing its independence from specific object instances and its ability to facilitate the creation of multiple object instances with unique properties and functionality.', "The instructor emphasizes the importance of declaring variables within the class to specify the data for a particular object, highlighting the significance of using 'this' as a reference to the current object instance in JavaScript.", 'The chapter illustrates the process of adding functionality to the bubble class, demonstrating the creation of a move function to change the x and y coordinates of the bubble object, and a show function to display the object on the screen.']}], 'highlights': ['The use of classes in JavaScript enables the encapsulation of object properties and functionalities, promoting code modularity and reusability by defining object templates.', 'The concept of treating graphics as objects with functionality, such as moving and displaying, is emphasized, aiming to write code to create objects and issue commands on them for dynamic and interactive screen movements.', 'The chapter delves into the concept of constructors and objects in JavaScript, detailing the process of defining a class, creating a constructor, and adding functionality to the class to create multiple object instances, with a focus on the bubble object.', "The instructor emphasizes the importance of declaring variables within the class to specify the data for a particular object, highlighting the significance of using 'this' as a reference to the current object instance in JavaScript.", 'The video introduces object-oriented programming in JavaScript, specifically using classes for the first time, as part of a playlist that initially covers functions.', 'The reorganization of code using functions is highlighted, where code for drawing and moving a circle is encapsulated into separate functions, emphasizing the organization of code.', 'The significance of functions as core building blocks of JavaScript is discussed, with reference to the suitability of JavaScript for functional programming.', 'The syntax of writing classes and making object instances is crucial in understanding object-oriented programming.', 'The new keyword in object-oriented programming creates an object instance, and it is used to execute a special kind of function to construct an object.', 'In object-oriented programming, a constructor needs to be written in every class to set up the object, similar to the setup function in P5 for initializing.', 'The chapter discusses the generic nature of a class as a template, emphasizing its independence from specific object instances and its ability to facilitate the creation of multiple object instances with unique properties and functionality.', 'The chapter illustrates the process of adding functionality to the bubble class, demonstrating the creation of a move function to change the x and y coordinates of the bubble object, and a show function to display the object on the screen.']}