function buildEVQuestionLists(category) {
var items = [];
var mySurvey = SurveyUtil.Surveys.Get(CurrentPID());
var remoteQuestions = mySurvey.Questions;
for (var i = 0; i < remoteQuestions.Count; i++) {
var question = remoteQuestions[i];
if (question.IsInCategory(category)) items.push(question.Id);
}
return items;
}
This is what return items gives:[EV10013,EV10361,EV10022,EV10009,EV10003,EV10025,EV10020,EV10017,EV10005,EV10000,EV10043,PH10040,PH10013]
Now I would like to go through this list and only return the items that start with ‘EV’.
As you tagged startswith, instead of filtering the array afterwards, you could add an extra check if the string starts with
EV
before pushing the question id to the items array.For example