0

I understand that bixby studio supports es6. so I used for of when writing the loop but I got the following error

ERROR missing ; after for-loop initializer

Please let me know what is wrong.

    // email  
    if (contactInfo.emailInfos) {
      for (let emailInfo of contactInfo.emailInfos) {  // <-- error is here
        if (emailInfo && emailInfo.address 
          && emailInfo.address.replace(/ /gi, '').toLowerCase().indexOf(keyword) > -1) {
          contactInfo.subText = emailInfo.address;

          return contactInfo;
        }
      }
    }
dummy data

  contactInfo = {
    nameInfo: {
      structuredName: 'James'
    },
    phoneInfos: [
      { number: '1234', phoneType: 'Home' },
      { number: '3456', phoneType: 'Work' }
    ],
    emailInfos: [
      { address: 'address1@email.com', emailType: 'Home' },
      { address: 'address2@email.com', emailType: 'Work' }
    ]
  }
hyeon62
  • 30
  • 6

1 Answers1

1

This syntax is not yet supported.

"The server-side JavaScript environment supports all of the ECMAScript 5.1 (ES5) language specification and some of ECMAScript 2015 (ES6)'s features"

Please refer the the online documentation for details.

Ameya
  • 880
  • 6
  • 13