### Creating A Class in JS
* Define a class using the constructor function:
* Capitalize the name of the class, CapitalCamelCased
```javascript
function NameOfClass(arg1, arg2, arg3,...) {
this.attribute1 = arg1;
this.attribute2 = arg2;
//...
//you can assign a function to this class:
this.function1 = function() {
//do something
}
}
NameOfClass.prototype.functionName = function() {};
//Creation of an object and evoking a function
obj = new NameOfClass();
obj.functionName();
```
* You can define may functions inside the class constructor, however, with every new
instantiated object, memory will be used up quickly. There is a place to put these functions
so that the object will still have access to them upon instantiation but won't use up memory:
**prototype**.
---
### Converting your class to ECMAScript6
```javascript
class NameOfClass {
constructor(attr1, attr2, ...) {
this.attr1 = attr1;
this.attr2 = attr2;
}
Function1() {
//this function is defaulted to be defined in prototype of the class
//code
}
}
```