Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var test = function(){
- this.hello = 'world';
- this.num = 1;
- }
- test.prototype = {
- valueOf: function(){
- return this.num;
- }
- }
- var obj = new test();
- var a = obj + 2;
- console.log(a); //print 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement