Created
March 26, 2018 12:40
-
-
Save zheeeng/c7006563e032d12ca717ea7c4283c651 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
function length (str) { | |
const regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g | |
return str.replace(regexAstralSymbols, '_').length | |
} | |
function reverse(str) { | |
return Array.from(str).reverse().join('') | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment