Created
December 11, 2020 09:00
-
-
Save conanak99/5f411c7a7f5c3016426c4ee8833ed646 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tách thành function riêng | |
// Trim and upper case | |
function chimUp(input) { | |
// Có bug chỉ cần sửa 1 chỗ | |
return input.trim().replace(/[^a-zA-Z ]/g, "").toUpperCase() | |
} | |
// Có thể dễ dàng dùng mà không cần copy paste | |
let input = chimUp('abd4%$#@#') | |
const username = 'ahihi-de-em-di' | |
const trimmedUsername = chimUp(username) | |
// ...Copy tiếp logic qua đoạn khác | |
const id = 'jro@091ksa' | |
return chimUp(id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment