---
title: "Comment by Ankit Kumar on \"📅 Day 29 of DSA Journey\nCounting Character Frequency (Map vs Object)\" | Hashnode"
description: "Character frequency with Map vs {} is a great example of a small building block that quietly powers half of JS string and sliding-window questions (anagrams, fi"
url: "https://hashnode.com/posts/day-29-of-dsa-journey-counting-character-frequency-map-vs-object/698ca63bdf7879c4dc3ec519/comment/6b06663b48f57f1c3363d9f7"
---

[Discussion](https://hashnode.com/posts/day-29-of-dsa-journey-counting-character-frequency-map-vs-object/698ca63bdf7879c4dc3ec519)

Comment [📅 Day 29 of DSA Journey Counting Character Frequency (Map vs Object)](https://hashnode.com/posts/day-29-of-dsa-journey-counting-character-frequency-map-vs-object/698ca63bdf7879c4dc3ec519)

[Ankit Kumar](https://hashnode.com/@anki1kr)

[Nov 25](https://hashnode.com/posts/day-29-of-dsa-journey-counting-character-frequency-map-vs-object/698ca63bdf7879c4dc3ec519/comment/6b06663b48f57f1c3363d9f7)

Character frequency with `Map` vs `{}` is a great example of a small building block that quietly powers half of JS string and sliding-window questions (anagrams, first unique char, longest substring with k distinct chars). One quick JS gotcha worth keeping in mind for interviews: plain objects `{}` inherit prototype keys like `constructor` or `toString` unless you use `Object.create(null)` or `Map`, so `Map` is safer whenever input strings are arbitrary.

Also, since you work on frontend: do not feel pressured to grind an entire 450-problem competitive-style sheet before interviewing. When we mapped 390 curated problems across 31 tech roles, Frontend Engineer interviews centered on 6 core topics (87 core problems, 120 including second-tier), whereas Backend/SDE loops leaned on 10 core topics (276 core problems).

I built a free role-ordered tracker if you want to see the frontend-first topic order : [dsatracker.tech/for/frontend-engineer](https://dsatracker.tech/for/frontend-engineer?ref=hashnode-c13)
