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.
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 toLowercase method is misspelled. It needs to be “toLowerCase” ![]()
Spot the Bug answer: The toLowercase() method is misspelled.
The fix:
Change toLowercase() to toLowerCase().
Why:
JavaScript string methods are case-sensitive. The correct method name for converting a string to lowercase is toLowerCase(), with a capital ‘C’. The current spelling will result in a TypeError because the method does not exist.
Got it: @kirupa ![]()
First-answer leaderboard
Ha, classic. I’ve definitely made that exact typo more times than I’d like to admit. My linter usually catches it before I even run the code.
:: Copyright KIRUPA 2026 //--
``` ```