Tell us what’s happening:
my code passes every test except for translating Titles such as “Mr.” to “Mr” even though it does in practice locally. It also capitalizes it just as the given FCC project does. What is wrong with the test or what am I missing?
my replit source code: https://repl.it/@jacklmbrt07/american-british-english-translator#components/translator.js
my github repository: https://github.com/jacklmbrt07/american-british-english-translator
Your code so far
Snippet of that code that gets executed (American to British):
var titleRegex = /(mr|mrs|ms|mx|dr|prof)\s/gi;
var titles = translation.match(titleRegex);
if (titles) {
titles.forEach((title) => {
translation = translation.replace(
title,
`<span class="highlight">${(title.charAt(0).toUpperCase() + title.slice(1)).replace(" ", ".")}</span> `
);
});
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36
.
Challenge: American British Translator