Node.js examples for Object:Class Definition
Class to Join letter to word
var Letters = function () { this.letters = [];/*from w w w .j a va 2s. c o m*/ }; Letters.prototype.push = function (letter) { this.letters.push(letter); return this; }; Letters.prototype.toWord = function () { return this.letters.join(''); }; var l = new Letters(); l.push('H') .push('e') .push('l') .push('l') .push('o'); console.log(l.toWord());