• could be a nice idea - I'll have a think! I've been meaning to try some contests - for example I reckon now tweets are 280 chars you could do some really interesting things in hardware JS :)

    @Robin as @allObjects says, each command you write on the left-hand side after you upload is changing the state of the interpreter. If you thought that each command you typed was executed on a fresh instance of your code it could actually be a really big cause of the problems you're having.

    Please check out some of the comments below - they might help.

    >var tb = new TestBind();
    =TestBind: { "vX": 25 }
                            <---- was there a command missing here?
    =25
    >tb.setX = 42;          <---- after this, tb.setX is now set to 42. It's no longer
                                  a function
    =42                     
    >print tb.getX();       <---- again, this is NOT how you use print or call a 
                                  function in JS. if you want the console to say 
                                  '=value' just type 'tb.getX()' 
                                  - you don't need 'print'
    =25
    >var bg = g.bind(tb);   <---- as allObjects says - there must be some code here 
                                  you're not posting up as you didn't define 'g' 
                                  previously, but lets assume that code was 
                                  'g = tb.getX()'. 'g' will be 25, so is a number 
                                  and won't have a 'bind' method
    
    Uncaught Error: Function "bind" not found!
     at line 1 col 12
    var bg = g.bind(tb);
               ^
    >print bg               <---- not how you call print, as mentioned above. However 
                                  the code above errored so you wouldn't expect it to 
                                  have written anything to 'bg'
    =undefined
    >tb.setX(42);           <---- If you did this right at the start, it would have 
                                  worked. Since you called it after 'tb.setX = 42', 
                                  'tb.setX' is now 42 so it is not a function you 
                                  can call
    
    Uncaught Error: Expecting a function to call, got Number
     at line 1 col 4
    tb.setX(42);
       ^
    
About

Avatar for Gordon @Gordon started