I need to sort the following object in descending order and after that I should delete everything that comes after "_" and even it, to see which word is formed:
Here's what I've done:
var str = 'string muito grande para o comentário';
var count = {};
str.split('').forEach(function(v) {
if (v === ' ') return;
v = v.toLowerCase();
count[v] = count[v] ? count[v] + 1 : 1;
});
console.log(count);
count{
a:94
b:93
c:88
d:87
e:91
f:86
g:80
h:83
i:78
j:79
k:82
l:92
m:74
n:99
o:96
p:98
q:84
r:97
s:77
t:81
u:100
v:95
w:75
x:89
y:85
z:76
_:90
}