11/*
2- Explanation :- a user gives a String (it can be incomplete lower or
3- partial lower ) and then the program would convert it into a
4- complete (all characters in upper case) upper case string. The
5- logic we have used in the following program is: All the lower case
6- characters (a-z) has ASCII value ranging from 97 to 122 and their
7- corresponding upper case characters (A-Z) have ASCII values 32
2+ Explanation :- A user gives a string (it can be incomplete lowercase or
3+ partially in lowercase ) and then the program converts it into a
4+ completely (all characters in uppercase) uppercase string. The
5+ logic we have used in the following program is: All the lowercase
6+ characters (a-z) has [ ASCII](https://en.wikipedia.org/wiki/ASCII) value ranging from 97 to 122 and their
7+ corresponding uppercase characters (A-Z) have ASCII values 32
88 lesser than them. For example ‘a‘ has an ASCII value of 97
99 and ‘A‘ has an ASCII value of 65 (97 - 32). The same applies to other
1010 characters.
1111*/
1212
1313/**
14- * UpperCaseConversion takes any case-style string and converts it to the upper case -style string.
15- * @param {String } inputString any case style string
16- * @returns {String } upper case string
14+ * upperCaseConversion takes any case-style string and converts it to the uppercase -style string.
15+ * @param {string } inputString Any case style string
16+ * @returns {string } Uppercase string
1717 */
18- const UpperCaseConversion = ( inputString ) => {
18+ const upperCaseConversion = ( inputString ) => {
1919 // Take a string and split it into characters.
2020 const newString = inputString . split ( '' ) . map ( char => {
2121 // Get a character code by the use charCodeAt method.
2222 const presentCharCode = char . charCodeAt ( )
23- // If the character code lies between 97 to 122 it means they are in the lower case so convert it.
23+ // If the character code lies between 97 to 122, it means they are in the lowercase so convert it.
2424 if ( presentCharCode >= 97 && presentCharCode <= 122 ) {
2525 // Convert the case by use of the above explanation.
2626 return String . fromCharCode ( presentCharCode - 32 )
@@ -32,4 +32,4 @@ const UpperCaseConversion = (inputString) => {
3232 return newString . join ( '' )
3333}
3434
35- module . exports = UpperCaseConversion
35+ export { upperCaseConversion }
0 commit comments