Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Hey getting SyntaxError: missing ; after for-loop initializer.

Community Beginner ,
Jul 15, 2022 Jul 15, 2022

Hey yall im getting the above error when trying to execute the following for loop.

 

var prodLength = product.length;
for(let i = 0; i < prodLength; i++) {
    if (product[i][5] > 0) {
        if(quPn1.length <= 0) {
            quPn1 = product[i][1];
        } else if(quPn1.length >= 0) {
            if(quPn2.length <= 0) {
                quPn2 == product[i][1];
            } else if(quPn2.length >= 0) {
                if(quPn3.length <= 0) {
                    quPn3 == product[i][1]
                }
            }
        }
    } else if (product[i][5] <= 0) {
        // code
    }
};
 
product is a 2d array of variables refrenced to text fields eg.
const product = [
        [caPn1,caDsc1,caWe1,caUp1,caVol1,caTot1]
        [caPn2,caDsc2,caWe2,caUp2,caVol2,caTot2]
 
var caPn1 = String(this.getField("CaPn1").valueAsString);
var caPn2 = String(this.getField("CaPn2").valueAsString);
The end goal of the for loop is to loop through the 2d array checking for values greater than 1 in the fifth element of the interior array and if a value is seen to check a text field for text and if it is empty fill it with an element from the array. Thanks ahead of time for your help!
 
 
 
TOPICS
JavaScript , PDF forms
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jul 15, 2022 Jul 15, 2022
LATEST

Replace let with var

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 15, 2022 Jul 15, 2022
LATEST

Replace let with var

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines