cek*_*lru 6 google-apps-script
应用程序脚本为什么找不到包含在显然是数组的对象中的函数。
function test() {
var list = ['a', 'b', 'c'];
Logger.log(list.constructor.name) // Array
if ( list.includes('a') ){
Logger.log('yes');
}
return 'done';
}
Run Code Online (Sandbox Code Playgroud)
错误文字:
TypeError: Cannot find function includes in object a,b,c. (line 134, file "Code")
Run Code Online (Sandbox Code Playgroud)
我是google应用程序脚本的新手,现在我很生气。我已经在在线Javascript控制台中尝试过了,一切都很好。
由于评论有帮助,这是一个替代解决方案。
function test() {
var list = ['a', 'b', 'c'];
Logger.log(list.constructor.name) // Array
if ( list.indexOf('a') > -1 ){
Logger.log('Yes'); // 'Yes'
}
return 'done';
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2380 次 |
| 最近记录: |