Thread: Method problem

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0

    Method problem


    I have a code which has an exception plz help me to find it out
    I think the problem is for o.addto(12); but if yes I dont know how to fix it

    thanks ..............

    function addto(value){
    myvar +=value ;
    return ;
    }

    var o = new Object();
    o.myvar=0;
    o.addto=addto;
    o.addto(12);
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0
    I solved it
    function addto(value){
    this.myvar +=value ;
    return ;
    }

    but I dont know the reason :?

IMN logo majestic logo threadwatch logo seochat tools logo