Is JavaScript function.bind() supported in google sheets?
问题 Here a simple code i'm trying to run in google sheets script. The purpose is supplying the foreach callback function additional parameters. function print(str, num) { Logger.log(str + ": " + num); } function test() { var array = [1,2,3]; var str = "Stam"; //This line has an exception // TypeError: Cannot convert null to an object array.forEach(print.bind(null, str)); } test(); this code is based on the solution described here. I know there are other solutions, though i want to understand why