simple class example

by Terrance Smith

JavaScript

var showInfo = function (obj) {
    for (var member in obj) {
        console.info("member");
        console.info("Name=" + member + "|value:" + obj[member]);
    }
};

//simulating A car "class" in javascript
//note evething is accessable
 var Car = function( model ) {

  this.model = model;
  this.color = "silver";
  this.year  = "2012";

  this.getInfo = function () {
    return this.model + " " + this.year;
  };
};

var myCar = new Car("ford");