i am stuck in getting no of times a string appears in array. This is my array
let arr = [ "5281-A", "5280-A", "5280-B", "5281-B" ]
used the split("-")[0] to get only the alpabets
now i would like a end result as this(getting Alphabets from every Element)
newObj = [['A',2], ['B',2]]
now this doesn't need to be array it can be object.But i want this in this form cause then i would like to compare the newObj with the following array
resArray = [["A",2], ["B",1]]
and then return in this case that B has one less quantity.
Basically it is a will used for validation of two different tabs values before submission.
I am stuck with this for hours. Help will be hugely appreciated.