August 2017
Intermediate to advanced
1330 pages
56h 17m
English
Let's write some code to see how this works.
var SimpleAdd = Class.create();
SimpleAdd.prototype = {
initialize: function (n) {
gs.info('Creating new object');
this.number = (n - 0) || 0;
},
increment: function () {
this.number++;
gs.info(this.number);
return this;
},
type: 'SimpleAdd'
};
The first line creates a variable called SimpleAdd and executes the Class.create function. This starts the definition of the object.
The second line is where the prototype is edited in order to make the class actually do something. The prototype consists of two functions: initialize ...
Read now
Unlock full access