Friday, 26 December 2014

Class

Defines the characteristics of the object. It is a template definition of variables and methods of an object.

The class

JavaScript is a prototype-based language which contains no class statement, such as is found in C++ or Java. This is sometimes confusing for programmers accustomed to languages with a class statement. Instead, JavaScript uses functions as classes. Defining a class is as easy as defining a function.

In the example below we define a new class called Person.
var Person = function () {};

No comments:

Post a Comment