i want to search in array to find something
this is my array in this.state
materialUnits: [
{
unitID: '',
barcodeNo: '',
salePrice: '',
vatValue: '',
isdefault: '',
rate: ''
}
]
then in if condition something like this
const value = "1";
const searcharray = this.state.materialUnits.filter(data => {
return data.isdefault === value;
});
if (searcharray.length === 0) {
//do something
} else {
alert("cant 2 defaults");
}
Array.prototype.findorArray.prototype.findIndex?