# Spot the bug - #32

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

<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:** [May 21, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-32/681657/1 "2026-05-21T07:00:10Z")

</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:** ![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:** [May 22, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-32/681657/2 "2026-05-22T07:20:13Z")

</div>

`toLowercase()` is broken — JavaScript strings have `toLowerCase()` (capital C). As written you’ll get `TypeError: tag. trim(. . . ). toLowercase is not a function`. Fix:

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

```

JS is case-sensitive, so that one character means the method isn’t found at runtime.
