Skip to content

Instantly share code, notes, and snippets.

View omzi's full-sized avatar
🦄
Crafting amazing digital experiences ✨

Omezibe Obioha omzi

🦄
Crafting amazing digital experiences ✨
View GitHub Profile
@omzi
omzi / caseInverse.js
Last active November 12, 2020 13:57
Returns a string with inversed cases
/**
* Returns a string with inversed cases
* @param {String} string The 'string' to inverse the cases of its characters
*/
const caseInverse = string => {
let inversedString = '';
for (const letter of string) {
if (letter.toUpperCase() === letter) {
inversedString += letter.toLowerCase()
} else {
@omzi
omzi / caseInverse.js
Last active November 17, 2020 09:01
Returns a string with inversed cases
/**
* Returns a string with inversed cases
* @param {String} string The 'string' to inverse the cases of its characters
*/
const caseInverse = string => string.split('').map(letter => letter.toUpperCase() === letter ? letter.toLowerCase() : letter.toUpperCase()).join('');
module.exports = caseInverse;