``
var profiles= [
{
id: ‘id123’,
name: “lin”,
age: 23
},
{
id: ‘id456’,
name: “lin2”,
age: 12
},
{
id: ‘id678’,
name: “lin3”,
age: 13
}
];
var currentProfile = {
id: ‘id456’,
name: “lin2”,
age: 12
};
var currentProfileIndex = (profiles|| []).findIndex((profile) => profile.id === currentProfile .id);
console.log(currentProfileIndex );