当我调用下面列出的代码时,我收到以下错误。
Cannot find function contains in object Is Patient Fasting?/# of Hours->Yes; 12 hours.
我的代码:
var i = 0;
var tempFastingQuest = "";
var tempFastingAns = msg['OBR']['OBR.39'].toString();
while (msg['NTE'][i] != null) {
tempFastingQuest = msg['NTE'][i]['NTE.3']['NTE.3.1'].toString();
if (tempFastingQuest.contains("Yes"))
tempFastingAns = "Y";
i = i + 1
}
我在这里缺少什么?
答案 0 :(得分:2)
假设这是JavaScript:字符串没有contains()
方法,错误明确指出。也许您正在寻找search()
方法:if (tempFastingQuest.search('Yes') > -1) ...