Guest User

Untitled

a guest
May 25th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. function class1 () {
  2. // defining a property in the constructor
  3. this.a = 'value'
  4. }
  5.  
  6. new class1()
  7.  
  8.  
  9. function class2 () {
  10. // calling a function which defines the property
  11. this.setA('value')
  12. }
  13.  
  14. class2.prototype.setA = function (val) {
  15. this.a = val
  16. }
  17.  
  18. new class2()
Add Comment
Please, Sign In to add comment