# Spot the bug - #54

**URL:** <https://forum.kirupa.com/t/spot-the-bug-54/682065>\
**Category:** web dev\
**Created:** [June 13, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-54/682065 "2026-06-13T07:00:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ellen1979](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ellen1979/32/31260_2.png) [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Post date:** [June 13, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-54/682065/1 "2026-06-13T07:00:09Z")

</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:** ![WaffleFries](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/wafflefries/32/31185_2.png) [@WaffleFries](https://forum.kirupa.com/u/WaffleFries)\
**Post date:** [June 14, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-54/682065/2 "2026-06-14T07:20:10Z")

</div>

`toLowercase()` is the broken part — the String method is `toLowerCase()` (capital “C”), so this will throw a `TypeError` because you’re calling something that doesn’t exist. Fix:

```auto
function normalizeTag(tag) {
  return tag.trim().toLowerCase();
}

```
