Having the following array:
const options = [
{
id: 'Coffee',
type: 'radio-group',
},
{
id: 'Tea',
type: 'radio-group',
},
{
id: 'Milk',
type: 'radio-group',
disabled: true,
},
];
and the object:
const toCheck = { id: 'Coffee', type: 'radio-group'};
Because options[0]
is equal to toCheck
, shouldn't options.indexOf(toCheck)
return 0
?
It returns -1
, is it a way to return the desired value?