How to Create a Class in Javascript

There are so many ways to create a class in JavaScript, but this one is the easiest and simplest for me.

var Person = {
init: function(nameParam) { = nameParam;
printName: function() {
console.log('Name: '+;

var me = Object.create(Person);  // <== one level of inheritance



Share on FacebookShare on Google+Tweet about this on TwitterPrint this pageEmail this to someoneShare on Reddit

Leave a Reply