JavaScript Class

There are no class concept in JavaScript. But JavaScript uses functions as classes.Defining a class in JavaScript is as easy as defining a function.


function Member() { // code block to be executed }

In the example below we define a new class called Member.


<script language="javascript" type="text/javascript" >
function Member() {
    //Properties = "Max";
    this.age = "28";
    this.sayHello = function() {
        return + " Says Hello";
//Creating person instance
var m = new Member();