I have created a code that checks the existence of an specific string inside array-object:
array = [{'grade': 'two'}, {'grade': 'three'}, {'grade': 'four'}];
for (var i = 0; i < array.length; i++) {
if (array[i].grade === 'four'){
remIndex = [i];
break;
}
}
console.log(remIndex);
This code works.
But when i tried to convert it into a function it won't work:
function getARRAYINDEX( array, callOBJ, findSTRING){
for (var i = 0; i < array.length; i++) {
if (array[i].callOBJ === findSTRING){
remIndex = [i];
break;
}
}
return remIndex;
}