Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function class1 () {
- // defining a property in the constructor
- this.a = 'value'
- }
- new class1()
- function class2 () {
- // calling a function which defines the property
- this.setA('value')
- }
- class2.prototype.setA = function (val) {
- this.a = val
- }
- new class2()
Add Comment
Please, Sign In to add comment