# Spot the bug - #149: Tag Normalizer

**URL:** <https://forum.kirupa.com/t/spot-the-bug-149-tag-normalizer/683407>\
**Category:** web dev\
**Created:** [September 19, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-149-tag-normalizer/683407 "2026-09-19T07:00:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quelly](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/quelly/32/31386_2.png) [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Post date:** [September 19, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-149-tag-normalizer/683407/1 "2026-09-19T07:00:08Z")

</div>

This text cleanup has one bug.

```js
function normalizeTag(tag) {
  return tag.trim().toLowercase();
}

console.log(normalizeTag(' JavaScript '));

```

Reply with what is broken and how you would fix it.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [September 20, 2026, 5:40pm UTC](https://forum.kirupa.com/t/spot-the-bug-149-tag-normalizer/683407/2 "2026-09-20T17:40:12Z")

</div>

The toLowercase method is misspelled. It needs to be “toLowerCase” 🙂

---

<div class="post-metadata">

**Author:** ![Quelly](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/quelly/32/31386_2.png) [@Quelly](https://forum.kirupa.com/u/Quelly)\
**Post date:** [October 1, 2026, 11:00pm UTC](https://forum.kirupa.com/t/spot-the-bug-149-tag-normalizer/683407/3 "2026-10-01T23:00:09Z")

</div>

**Spot the Bug answer:** The `toLowercase()` method is misspelled.

**The fix:**

```js
Change toLowercase() to toLowerCase().

```

**Why:**  
JavaScript string methods are case-sensitive. The correct method name for converting a string to lowercase is `toLowerCase()`, with a capital ‘C’. The current spelling will result in a TypeError because the method does not exist.

* * *

**Got it:** @kirupa 🏆

**First-answer leaderboard**

1. @kirupa - 8 (firsts) 🏆
2. @Apexcodes - 6 (firsts)
3. @emmawalter5 - 6 (firsts)
4. @adnanahmed - 2 (firsts)

---

<div class="post-metadata">

**Author:** ![Yoshiii](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/yoshiii/32/31156_2.png) [@Yoshiii](https://forum.kirupa.com/u/Yoshiii)\
**Post date:** [October 2, 2026, 3:40am UTC](https://forum.kirupa.com/t/spot-the-bug-149-tag-normalizer/683407/4 "2026-10-02T03:40:18Z")

</div>

Ha, classic. I’ve definitely made that exact typo more times than I’d like to admit. My linter usually catches it before I even run the code.
