Google apps script TypeError:在对象9中找不到函数替换。(第51行,文件“main”)
我试图根据以下内容从电子表格中设置okr树,但在其中一个函数中出现错误:Google apps script TypeError:在对象9中找不到函数替换。(第51行,文件“main”),google-apps-script,Google Apps Script,我试图根据以下内容从电子表格中设置okr树,但在其中一个函数中出现错误: function arrayToObj(array) { return { //error in this line id: array[0], name: array[1], title: '<p class="okr-label">O</p><p class="okr-text">' + array[3].repla
function arrayToObj(array) {
return { //error in this line
id: array[0],
name: array[1],
title: '<p class="okr-label">O</p><p class="okr-text">' + array[3].replace(/\n/g, '<br>') + '</p><p class="okr-label">KR</p>' + array[4].replace(/\n/g, '<br>'),
}
}
函数ArrayTobj(数组){
返回此行中的{//错误
id:数组[0],
名称:数组[1],
标题:'O
'+array[3]。替换(/\n/g,
')+'
KR
'+array[4]。替换(/\n/g,
'),
}
}
TypeError:在对象9中找不到函数替换。(第51行,文件
“主要”)
您试图对数字使用
string.replace()
。您是否已尝试先将其转换为字符串?您正在尝试对数字使用string.replace()
。你试过先把它转换成字符串吗?