typescript - Unexpected token; 'constructor, function, accessor or variable' expected -


sorry newbie question, trying learn type script.

i have following class

class indexgridfunctions  {        //error on var      var blocksperrow: (windowwidth:number)=>number      = function (windowwidth)      {          return math.floor(windowwidth / 12);      };        var blockspercolumn: (windowheight: number) => number      = function (windowheight)      {          return math.floor(windowheight / 17);      };        shirtstodisplay: () => number      = function ()      {          return blocksperrow * blockspercolumn;      };    } 

i getting error @ first var. error "unexpected token; 'constructor, function, accessor or variable' expected".

what doing wrong?

tia

don't use var. invalid syntax within class body. fixed code :

class indexgridfunctions {      blocksperrow: (windowwidth: number) => number     = function (windowwidth) {         return math.floor(windowwidth / 12);     };      blockspercolumn: (windowheight: number) => number     = function (windowheight) {         return math.floor(windowheight / 17);     };      shirtstodisplay: () => number     =  () => {         return this.blocksperrow(123) * this.blockspercolumn(123);     };  }  

i did other fixes code in code ive presented:


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -