The console. The error (" file: pages/index/index, js \ n unknown: Unexpected token, expected, \ n | 31} wherefore, 32 | \ \ n n> 33 | for (I=0; I=& lt; LTH. + + I) {\ n | ^ \ n 34 | enclosing setData ({x1: x1 + word2 (I)}) 35 | \ n the if (I & gt; LTH) break; 36 |} \ n ")
The console. GroupEnd ()
The above errors, an array of word sum, JS code is as follows:
for(i=0; I=& lt; LTH. + + I) {
Enclosing setData ({x1: x1 + word2 (I)})
If (I & gt; LTH) break;
}
What's the problem?
CodePudding user response:
LTH is the length of the array, the X1 is the sum of the values,CodePudding user response:
Globally defined arrays and combined, and then calculate
STR: [1, 2, 3],
Num: 0,
For (var I=0; iThat. Data. Num +=that. Data. The STR [I];
}