Tuesday, September 11, 2012

Constructor Pattern in JavaScript

Constructor Pattern in JavaScript: Over the last few weeks I've been learning Object-Oriented concepts in JavaScript and have been building applications on top of it. I've an understanding of Object-Oriented concepts in many of the Server side programming languages and was trying to draw parallel lines with JavaScript. As it turns out, JavaScript is a class-less language but the concept of classes can be simulated using functions. In JavaScript, functions are not primitive types but are special kind of objects and hence you can set properties on them and can also invoke methods on them. Here's a simple JavaScript class: function Shape(name, sides) {    this.name

DIGITAL JUICE

No comments:

Post a Comment

Thank's!