Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Use Prototype To Add A Property To Javascript Class

		  function Student{
		 
 			  this.name = name;
				  this.age = age;		
		 
 		
		  }
	
 
function add()
		  {
			  Student.prototype.eyeColor = "Blue";		  	
	let std=		  new Student("John", 33);
	console.log(std.eyeColor);  
		  }
/*will display blue*/
 
PREVIOUS NEXT
Tagged: #Use #Prototype #To #Add #A #Property #To #Javascript #Class
ADD COMMENT
Topic
Name
4+7 =