Why does app scripts not find the function includes in the object that is clearly an Array.
function test() {
var list = ['a', 'b', 'c'];
Logger.log(list.constructor.name) // Array
if ( list.includes('a') ){
Logger.log('yes');
}
return 'done';
}
The error text:
TypeError: Cannot find function includes in object a,b,c. (line 134, file "Code")
I am new with google app scripts and I am getting mad. I have tried it in a online Javascript console and everything is fine.
Due to the comment that helped, this is an alternative solution.
function test() {
var list = ['a', 'b', 'c'];
Logger.log(list.constructor.name) // Array
if ( list.indexOf('a') > -1 ){
Logger.log('Yes'); // 'Yes'
}
return 'done';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With