Using JavaScript functions as "classes": What am I doing wrong here? -
here's javascript "class" far: function snake(c, c_h, c_w) { this.linksize = 10; // size of snake unit, in pixels /* on instantiation, snake direction down , has 1 link */ this.dy = this.linksize; this.dx = 0; this.link = c.rect(c_h/2, c_w/2, this.linksize, this.linksize); this.link.attr("fill", "#d7a900"); this.body = [link]; /* event listener changing direction of snake arrow keys on keyboard */ this.redirect = function(dirnum) { switch (dirnum) { /* dirnum corresponds 1 ---> right 2 ---> down 3 ---> left 4 ---> */ case 1: this.dx = this.linksiz...