C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Javascript »

Implementation of prototype property in Javascript


Posted Date: 01 Nov 2008    Resource Type: Code Snippets    Category: Javascript
Author: Shanthi MMember Level: Gold    
Rating: 1 out of 5Points: 8



The prototype property allows to add properties and methods to an object.

The following code snippet shows how to implement prototype property using Javascript.


//Paste the code into script tag
function employee(name,age)
{
this.name=name;
this.age=age;
}
var emp=new employee("Shanthi","22");
employee.prototype.qualification=null;
emp.qualification="BE";
document.writeln(emp.name);
document.writeln(emp.age);
document.write(emp.qualification);



Responses

Author: Nitin Mathur    03 Nov 2008Member Level: Silver   Points : 1
Hi
its good information for web developers.
but..
Where is the qualification property in function?
are u missing something?

Thanks


Author: Shanthi M    03 Nov 2008Member Level: Gold   Points : 1
Hai Nitin,
The prototype property allows to add properties and methods to
an object. Here I add the property 'qualification' to the object 'emp' of type 'employee'.



Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Implementation of prototype property in Javascript  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: To List the properties of document in Javascript
Previous Resource: Create book mark link in your site
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use