Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Another _.extend Example

Person = function(name)
{
  this.name = "name";
  this.a = function(a)
 
 {console.log(a)
 
 }

 this.a(this.name);
  this.b();
}

_.extend(Person.prototype, {x: function(){console.log(this.name)}, b: function(){console.log("BBBBBBBBBBBBB")}});

const p= new Person("XXXX");
p.x();


the above is valid code so long as a this.name exists in the Person.prototype

the this.b() is also valid code so long as b() is added in later at the _.extend() part.
 
PREVIOUS NEXT
Tagged: #Another #Example
ADD COMMENT
Topic
Name
7+8 =