Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
9
Task/Reverse-a-string/JavaScript/reverse-a-string-1.js
Normal file
9
Task/Reverse-a-string/JavaScript/reverse-a-string-1.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
example = 'Tux 🐧 penguin';
|
||||
|
||||
// array expansion operator
|
||||
[...example].reverse().join('') // 'niugnep 🐧 xuT'
|
||||
// split regexp separator with Unicode mode
|
||||
example.split(/(?:)/u).reverse().join('') // 'niugnep 🐧 xuT'
|
||||
|
||||
// do not use
|
||||
example.split('').reverse().join(''); // 'niugnep \udc27\ud83d xuT'
|
||||
Loading…
Add table
Add a link
Reference in a new issue