I have an array like
selectedData = [{ Name = 'Michelle', LRN = '100011' }, { Name = 'Micheal', LRN = '100011' }, { Name = 'Mick', LRN = '100012' } // so on.... ]
I am sending this array through a function and that simply checks if the LRN attribute of each object is same if not it throws error. I have written the function as -
createSet(selectedData) { this.selectedData.forEach (element => { //the condition } else { this.openSnackBar ("LRN mismatching"); } }
How do I check if the LRN attribute of each object is same? I don't want loop unless I have to. I'm working with more than thousand records. I appreciate all the help. :)