$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · medium · #288

What goes in the blank?

// count words with a Map
const counts = new Map<string, number>();
for (const w of words) {
  counts.set(w, (counts.____(w) ?? 0) + 1);
}

Answer: get (also accepted: get)

Map values are read with get(); ?? 0 covers words that have not been seen yet.
Play Problem Solving ▸