getMaxItem(str) {
const value = str.split(’’);
const newvalue = [];
value.map(event => {
if (newvalue.length === 0) {
newvalue.push({key: event, value: 1});
return;
}
const index = newvalue.findIndex(item => item.key === event);
if (index !== -1) {
newvalue[index].value += 1;
} else {
newvalue.push({key: event, value: 1});
}
});
newvalue.sort((a, b) => { return b.value - a.value; });
console.log(newvalue[0])
}