fork download
  1. function counter (surnames) {
  2. var count = {};
  3. surnames.split(',').forEach(function(s) {
  4. count[s] ? count[s]++ : count[s] = 1;
  5. });
  6. return count;
  7. }
  8.  
  9. print(counter("ala,ma,kota,ala").toSource());
Success #stdin #stdout 0.01s 30320KB
stdin
Standard input is empty
stdout
({ala:2, ma:1, kota:1})