Class

Creating a Class definition in JavaScript

There are different ways to define classes in JavaScript. However, this is the most widely used and accepted at the moment: //class function Person(sLastName, sFirstName, iAge) { this.lastName = sLastName; this.firstName = sFirstName; this.age = iAge; this.phoneNumbers = new Array(); } //method Person.prototype.showFullName = function() { alert(this.lastName + " " + this.firstName); }; //instances var oPerson1 = new Person("Lacava", "Alessandro", 30); var oPerson2 = new Person("Brown", "John", 50); oPerson1.phoneNumbers.push("1234567"); oPerson2.phoneNumbers.push("7654321"); oPerson1.