Disclaimer: I fully understand the risks/downsides of using eval but this is one niche case where I couldn\'t find any other way.
In Google Apps Scripting, there sti
You cannot evaluate
{
fetchDate: function() {
var d = new Date();
var dateString = (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear();
return dateString;
}
}
Because it is not a valid expression (Object literals on their own are interpreted as blocks. fetch: function () { } is not a valid expression).
Try
var myLibName = {
fetchDate: function() {
var d = new Date();
var dateString = (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear();
return dateString;
}
};