(inputString)
| 16 | * @returns {string} Uppercase string |
| 17 | */ |
| 18 | const upperCaseConversion = (inputString) => { |
| 19 | // Take a string and split it into characters. |
| 20 | const newString = inputString.split('').map((char) => { |
| 21 | // Get a character code by the use charCodeAt method. |
| 22 | const presentCharCode = char.charCodeAt() |
| 23 | // If the character code lies between 97 to 122, it means they are in the lowercase so convert it. |
| 24 | if (presentCharCode >= 97 && presentCharCode <= 122) { |
| 25 | // Convert the case by use of the above explanation. |
| 26 | return String.fromCharCode(presentCharCode - 32) |
| 27 | } |
| 28 | // Else return the characters without any modification. |
| 29 | return char |
| 30 | }) |
| 31 | // After modification, with the help of the join method, join all the characters and return them. |
| 32 | return newString.join('') |
| 33 | } |
| 34 | |
| 35 | export { upperCaseConversion } |
no outgoing calls
no test coverage detected