This week we will review
- variables
- functions
- introduce objects
- review conditional statements
Objects
Objects encapsulate both data and code (i.e. variables and functions)
Syntax to create an object:
// let's define a bubble
class Bubble {
// everything that it means to be a bubble
}
// let's create instances of bubbles
let bubble1 = new Bubble();
let bubble2 = new Bubble();
Glossary of Term
- Class - is like the template of the object. Dan describes it as the cookie cutter
- Define a Class
- Instance or Object - a single object that has been created using a class definition - Dan describes as the cookie
- Instantiate an Object - To create an instance of a class. An object is constructed using the new keyword
- Constructor is a special function within a class that is called to setup the object