javascript - Node.js forEach: cannot read property '[object Array]' of undefined -


i've never seen 1 before. error occurred on both node.js 6.3.0 , 6.9.1 lts, updated in effort resolve this.

i'm trying build stats game based on data have, not particularly important. important following function, part of game class, fails:

computestats() {   var stats     , roster     , team, opp, scorestate, oppscorestate     , toi = this.calculatetoidata()     , eventcounter = this.calculateeventdata()    [['home', 'away'], ['away', 'home']].foreach((teams) => { //this line 74 / error source     team = teams[0];     opp = teams[1];      roster = this[team].roster;      stats = {       //some assignments occur here toi , eventcounter objects     }      this.setstats(team, stats);   }) } 

the error thrown is

typeerror: cannot read property '[object array]' of undefined     @ gametracker.computestats (/users/nawgszy/repo/lib/game.js:74:5)     @ new gametracker (/users/nawgszy/repo/lib/game.js:39:10) 

i have no idea how possible. array hard-coded, right there. ideas? can work around it, find specific structure easiest way generate stats want use.

it's asi messing guess. add semicolon after eventcounter = this.calculateeventdata() , see how runs.

more info : http://benalman.com/news/2013/01/advice-javascript-semicolon-haters/


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -