Hello I have a quick question regarding my javascript array:
var firstrecord = {
name: 'Luca',
age: '19'
};
var secondrecord = {
name: 'Hans',
age: '25'
}
var myArray = [];
myArray.push(firstrecord,secondrecord);
Alright, now I have a var SearchString = "Lu".
What I'd do:
for (var i = 0; i < myArray.length; i++) {
if (myArray[i].[name].IndexOf(SearchString, i)) != 1){
return myArray[i];
}
}
But this doesn't work. Is there any solution to this problem ?
Update: indexOf != IndexOf Reminder to self.. first lookup the use of such functions before misusing them. :)