Skip to content Skip to sidebar Skip to footer

Google Apps Script Throws Error When Trying To Call Object.assign()

Google Apps Script doesn't appear to recognize the function Object.assign(). When trying to use it I get the error: TypeError: Cannot find function assign in object function Objec

Solution 1:

Apps Script is NOT (as of this writing) a full implementation of the Ecmascript standard and currently does not natively support Object.assign(). However, you can leverage polyfills (when viable) that can add the needed functionality.

There is a polyfill available for Object.assign() on MDN at the following link:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill

Note: Rumor has it that Apps Script will be upgraded (at some point in the near future) to use Chrome's V8 engine thereby supporting EcmaScript 2017.

Post a Comment for "Google Apps Script Throws Error When Trying To Call Object.assign()"