Spot the bug - #106: Tag Normalizer

This text cleanup has one bug.

function normalizeTag(tag) {
  return tag.trim().toLowercase();
}

console.log(normalizeTag('  JavaScript  '));

Reply with what is broken and how you would fix it.

The trim method needs an argument to specify how to trim :sweat_smile:

Trim’s fine actually, no args needed there. It just strips whitespace from both ends by default. The real bug is toLowercase(). Method’s actually toLowerCase() with a capital L.

1 Like