// for dictionary case use findIndex
var imageList = [
{value: 100},
{value: 200},
{value: 300},
{value: 400},
{value: 500}
];
var index = imageList.findIndex(img => img.value === 200);
// find index of array item; test values using a function
const arr = ['A','B','C'];
const index = arr.findIndex((item) => item === 'B'); // index == 1
const index = array.findIndex((param)=> param.name == "jimmy")
/* param will iterate on every value of the array looking for
that one element that fits the criteria that is indicated in arrow function
besides it */
$scope.indexOfField = function(fieldId) {
var fieldData = $scope.model.fieldData,
i = 0, ii = $scope.model.fieldData.length;
for(i; i < ii; i++) if(fieldData[i].Id === fieldId) break;
// use i
}