Test cases
Test #1 Title *
Async
Code * function getFlagEmoji (countryCode ) {
return countryCode.toUpperCase ().replace (/./g , char =>
String .fromCodePoint (127397 + char.charCodeAt ())
);
}
getFlagEmoji ('de' )
getFlagEmoji ('CH' )
Test #2 Title *
Async
Code * function getFlagEmoji (countryCode ) {
const codePoints = countryCode
.toUpperCase ()
.split ('' )
.map (char => 127397 + char.charCodeAt ());
return String .fromCodePoint (...codePoints);
}
getFlagEmoji ('de' )
getFlagEmoji ('CH' )
Title *
Async
Code * function getFlagEmoji (countryCode ) {
return [...countryCode.toUpperCase ()].map (char =>
String .fromCodePoint (127397 + char.charCodeAt ())
).reduce ((a, b ) => `${a} ${b} ` );
}
getFlagEmoji ('de' )
getFlagEmoji ('CH' )
Title *
Async
Code * function getFlagEmoji (countryCode ) {
return [...countryCode.toUpperCase ()].map (char =>
String .fromCodePoint (127397 + char.charCodeAt ())
).reduce ((a, b ) => a + b);
}
getFlagEmoji ('de' )
getFlagEmoji ('CH' )
Title *
Async
Code * function getFlagEmoji (countryCode ) {
return [...countryCode.toUpperCase ()].map (char =>
String .fromCodePoint (127397 + char.charCodeAt ())
).join ('' );
}
getFlagEmoji ('de' )
getFlagEmoji ('CH' )
Title *
Async
Code * function getFlagEmoji (countryCode ) {
const codePoints = countryCode
.toUpperCase ()
.split ("" )
.map ((char ) => 127397 + char.charCodeAt (0 ));
return String .fromCodePoint (...codePoints);
}
getFlagEmoji ('de' )
getFlagEmoji ('CH' )