function strChck(str) {
//str in each char how many repeated
let charmap = {};
for (char of str.replace(/[^\w]/g, '').toLowerCase()) {
console.log(charmap[char]);
charmap[char] = charmap[char] + 1 || 1;
}
return charmap;
}
Hi guys I want to understand that code for > charmap[char] = charmap[char] + 1 || 1;
how the code made object value like {m:4} as m charcter is repeated in string for 4 times ? > can't understand the value how it be nummber and be increased , my brain said it should be m+1 ?