JSFiddle - React, Tailwind, and code Playground

by broofa

JavaScript

function a(s) {
    var r = {};
    s.replace(/./g, function (c) {
      r[c] = (r[c] || 0) + 1;
    });
    return r;
}
console.dir(a('abacad'))