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.
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.
:: Copyright KIRUPA 2024 //--