# Spot the bug - #56

**URL:** <https://forum.kirupa.com/t/spot-the-bug-56/682100>\
**Category:** web dev\
**Created:** [June 15, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-56/682100 "2026-06-15T07:00:08Z")\
**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 15, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-56/682100/1 "2026-06-15T07: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:** ![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:** [June 16, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-56/682100/2 "2026-06-16T07:20:13Z")

</div>

`toLowercase()` is the broken bit — JavaScript’s string method is `toLowerCase()` with a capital C, so your function will throw `TypeError: tag. trim(. . . ). toLowercase is not a function`. Fix:

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

```
