mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-09 05:35:45 +08:00
merge: reduce upper & lower & add export default (#960)
This commit is contained in:
@ -12,13 +12,8 @@ const upper = (str) => {
|
||||
}
|
||||
|
||||
return str.replace(
|
||||
/[a-z]/g,
|
||||
(_, indexOfLowerChar) => {
|
||||
const asciiCode = str.charCodeAt(indexOfLowerChar)
|
||||
|
||||
return String.fromCharCode(asciiCode - 32)
|
||||
}
|
||||
/[a-z]/g, (char) => String.fromCharCode(char.charCodeAt() - 32)
|
||||
)
|
||||
}
|
||||
|
||||
export { upper }
|
||||
export default upper
|
||||
|
Reference in New Issue
Block a user