Here is the JSON data I have:
[
{"lastName":"Noyce","gender":"Male","patientID":19389,"firstName":"Scott","age":"53Y,"},
{"lastName":"noyce724","gender":"Male","patientID":24607,"firstName":"rita","age":"0Y,"}
]
var searchBarInput = TextInput.value;
var results = []; // initializing array to store results
for (var i = 0; i < recentPatientsList.length; ++i) {
if (recentPatientsList[i].lastName.indexOf(searchBarInput) == 0) {
results.push(recentPatientsList[i].lastName);
}
}
alert('Results: ' + results.toString());
I am able to get the result, but I would like to have it consider both uppercase and lowercase when searching for a character at the start of a word.