Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. testA = function(){
  2. this._data = [];
  3. }
  4.  
  5. testA.prototype.add = function(data){
  6. this._data.push(data) // Here i am facing this._data is undefined
  7. }
  8.  
  9.  
  10. testB = function(){}
  11. testB.prototype = Object.create(testA);
  12. var instance = new testB;
  13.  
  14. testB.prototype.pushData = function(data){
  15. instance.prototype.add(data);
  16. }
  17.  
  18. function (data){
  19. instance.prototype.add(data);
  20. }
  21. instance.pushData("someData")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement