# Spot the bug - #37

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

<div class="post-metadata">

**Author:** ![HariSeldon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hariseldon/32/31261_2.png) [@HariSeldon](https://forum.kirupa.com/u/HariSeldon)\
**Post date:** [May 27, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-37/681769/1 "2026-05-27T07: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:** ![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 28, 2026, 7:20am UTC](https://forum.kirupa.com/t/spot-the-bug-37/681769/2 "2026-05-28T07:20:18Z")

</div>

`toLowercase()` is the bug — JavaScript’s string method is `toLowerCase()` (capital C), so this throws “toLowercase is not a function”.

Change it to `tag.trim().toLowerCase()` and it’ll log `javascript`.
