tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 jQuery > Basic > JS classes and callbacks

JS classes and callbacks 

The following example shows how to define class templates in java script and its instantiation. In java script there is no difference between 'function' and 'class template'. Unlike 'java' constructors we need to explicitly specify return type of 'constructor function'. Its done with return this statement. It has two public methods 'show' and 'loop'. The first one accepts a string as argument and shows an alerts, the second accepts a reference to other java scripts function as argument. Usually these references are called 'callback' functions. The 'loop' method invokes the 'callback' function. It also shows creating global references. The symbol '$$$' acts as an alias to 'Message' class template (window.$$$ = Message).

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]


bl  br