Xah Talk Show 2020-09-23 Emacs Lisp Format JavaScript, the Idiocy of Formatting Style Guide

Xah Talk Show 2020-09-23 Emacs Lisp Format JavaScript, the Idiocy of Formatting Style Guide
const text1 =
  `Keyboard Guide Character Frequency Counter By Xah Lee. Date: 2017-05-01. Last updated: 2020-09-21. Plot character frequency. type or A-Z No Chinese Top 30 only 26.3e21.0t10.5p10.5r5.2y5.2o5.2a5.2s5.2x 5.2hTotal 2017 8299f 拼音字母頻率 japan input 2020-05-07 zn3qs Japanese Input Method jp layout icon 3rmg5 Japanese Layouts Japanese Jack London 50383 $5 amazon egift card to xah@xahlee.org , $20 is nice. paypal to xah@xahlee.org , $20 is nice. If you have a question, put $5 at patreon and message me. Typewriters Misc 🎮 🎹 Misc2 🎧 🎤 BlogXAH © 1995, 2020 Xah Lee. `;

const f1 = ((xStr) => {
  const tt = new Map();
  for (let c of xStr) ((tt.has(c)) ? tt.set(c, tt.get(c) + 1) : tt.set(c, 1));
  return tt;
});

const f2 = ((charsMap, n) =>
  [...charsMap.entries()].sort((x, y) => {
    const aa = x[1];
    const bb = y[1];
    if (aa === bb) return 0;
    else if (aa > bb) return -1;
    else return 1;
  }).slice(0, n));

const x1 = f1(text1);
console.log(x1);
console.log(f2(x1, 5));

xah_talk_show_2020-09-23.txt

If you have a question, put $5 at patreon and message me.