phatneff
phatneff

Reputation: 1

Cannot Find Function Contains in Object

I'm getting the following error when I call the code listed below it.

Cannot find function contains in object Is Patient Fasting?/# of Hours->Yes; 12 hours.

My code:

    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
    }

What am I missing here?

Upvotes: 0

Views: 3176

Answers (1)

BlackJack
BlackJack

Reputation: 4689

Assuming this is JavaScript: Strings don't have a contains() method, which the error clearly states. Maybe you are looking for the search() method: if (tempFastingQuest.search('Yes') > -1) ...

Upvotes: 2

Related Questions