Thursday, January 17, 2013

Basics of JavaScript Classes (ECMASCRIPT)

ECMASCRIPT is a method of (concept of) using JavaScript as Object Oriented designing.  Knowing about this; help you to work on SharePoint Client Object Development, SharePoint Apps Development as well as any web development that involves JavaScript Objects)

There are few concepts you need to know. I will compare those using general OOP language (C#) and ECMASCRIPT. (C# vs. JavaScript)

Creating a Class

image image

Creating a Object

image image

Public and Private Properties

image image

Method Definition (in best way)

 image image

(Note: Prototype is something like a template; we are assigning method save() to  the template thus it will not recreate the everything in the browser memory every type we are creating a object. so assigning the method to the prototype is the best way to do it.)

Inheritance

image image

Post a Comment