不能在 bixby studio 中使用 for ... of 吗?
Can't use for ... of in bixby studio?
我了解到bixby studio支持es6。
所以我在编写循环时使用了 for of
但我收到以下错误
ERROR missing ; after for-loop initializer
请让我知道哪里出了问题。
// 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' }
]
}
尚不支持此语法。
"The server-side JavaScript environment supports all of the ECMAScript 5.1 (ES5) language specification and some of ECMAScript 2015 (ES6)'s features"
详情请参考online documentation。
我了解到bixby studio支持es6。
所以我在编写循环时使用了 for of
但我收到以下错误
ERROR missing ; after for-loop initializer
请让我知道哪里出了问题。
// 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' }
]
}
尚不支持此语法。
"The server-side JavaScript environment supports all of the ECMAScript 5.1 (ES5) language specification and some of ECMAScript 2015 (ES6)'s features"
详情请参考online documentation。