Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function T() { this.a='a' }
- >undefined
- T.prototype = { o: { p:1 } }
- >Object
- t1 = new T
- >T
- t2 = new T
- >T
- t1.o.p = 2
- >2
- t2.o.p
- >2 ---------------- FAIL
- T.prototype = { init: function() { this.o = { p:1 } } }
- >Object
- function T() { this.a='a'; this.init() }
- >undefined
- T.prototype = { init: function() { this.o = { p:1 } } }
- >Object
- t1 = new T
- >T
- t2 = new T
- >T
- t1.o.p = 2
- >2
- t2.o.p
- >1 ---------------- SUCCESS
Advertisement
Add Comment
Please, Sign In to add comment