Home > Mobile >  Novice old question: variable scope. OK in development tools, the real machine debugging is various
Novice old question: variable scope. OK in development tools, the real machine debugging is various

Time:03-23

This program in development tools directly the console. The log shows calls, traverse the works, in the end with real machine debugging error, length undefine,
 

OnLoad: function () {

Var that=this;
Const eventChannel=this. GetOpenerEventChannel ()
EventChannel. On (' acceptDataFromOpenerPage ', function (data) {
That the setData ({
Result: the data [0],
UserAnswer: data [1],
})
})

Var userAnswer=this. Data. UserAnswer;
Var result=this. Data. The result;

Var maxCount=0;
Var unitCount=[];

The console. The log (result)
for (let i=0; i Var letnum=result [I] num
Var yourCount=0

for (let i=0; i YourCount=yourCount + parseInt (userAnswer [letnum [I]]).
}
UnitCount=unitCount. Concat (yourCount)



}



  • Related