Generation

generate functionTue, 13 Jun 2023

count how many time repeat each char in a String

Script 'aaabbbcc'.split('').reduce(function(acc, cur){ if(acc[cur]) { acc[cur] += 1; } else { acc[cur] = 1; } return acc; }, {})

Want to kickstart your project?Use the new AI Studio to create your code