Hello, I do not understand why she gets out everything is

m.forEach((match, groupIndex) => { if(groupIndex == 1){/* console.log('===Found match, group '+groupIndex+':'+match);*/ /*eval('ArrElem'+E+'_lvl_2['+I+'] = '+match)*/} }); 

the console is working and eval is not. This error refers to the beginning of the line, but as I understand it from eval, here is the cycle in which it is involved

Elem_lvl_1.output - 'css ("background-image")' E is just a number for dynamic variables.

 for (var I = 0;I <= Tag_L-1; I++) { var regex = /"([^"]+)"/gi, str = eval('ArrElem'+E+'_lvl_2['+I+'] = Elem_lvl_1.tag.eq('+I+').'+Elem_lvl_1.output), m; while ((m = regex.exec(str)) !== null) { if (m.index === regex.lastIndex) { regex.lastIndex++; } m.forEach((match, groupIndex) => { if(groupIndex == 1){/* console.log('===Found match, group '+groupIndex+':'+match);*/ /*eval('ArrElem'+E+'_lvl_2['+I+'] = '+match)*/} }); }} 
  • so which code doesn't work? for what values? - Grundy
  • Eval, which is in the comment. The code completely breaks when I remove from the comment. When it is under the comment, the code functions normally. Why this happens I do not understand. In fact, I'm here in the procedural array giving the result of the regular group 1 - Gotha
  • make an example that you can run and see a mistake, you can insert a snippet into the question that you can run and see a mistake - Grundy

1 answer 1

The whole problem. What the data that I was trying to push into the array was not in quotes. The data was bace64, but there it was; it turned out like this

 ArrElem0_lvl_2[0] = data:image/jpeg;base64,/9j/4A... 

Ie without quotes that determine that this is a string, I'm sorry I disturbed you for such a stupid problem