# Spot the bug - #33

**URL:** <https://forum.kirupa.com/t/spot-the-bug-33/681687>\
**Category:** web dev\
**Created:** [May 22, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-33/681687 "2026-05-22T07:00:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BobaMilk](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bobamilk/32/31157_2.png) [@BobaMilk](https://forum.kirupa.com/u/BobaMilk)\
**Post date:** [May 22, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-33/681687/1 "2026-05-22T07:00:11Z")

</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:** ![MechaPrime](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mechaprime/32/31154_2.png) [@MechaPrime](https://forum.kirupa.com/u/MechaPrime)\
**Post date:** [May 23, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-33/681687/2 "2026-05-23T07:20:17Z")

</div>

`toLowercase()` is the bug — JavaScript’s string method is `toLowerCase()` (capital C), so the current code hits `undefined` and then blows up when you try to call it.

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

```
