Last active
October 8, 2017 16:30
-
-
Save the-creature/c7abbe921587e9c716b95120f3a3b51c to your computer and use it in GitHub Desktop.
ES6 Filter, Sort, Split function
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
const sentence = ( p = 'text some txt' ) => p.split(' ').filter(v => !(v.length % 2)).sort((a, b) => a.length - b.length).toString().replace(/\W/g, ' '); | |
sentence('longer sentence with in to blah!'); // "in to with longer sentence" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment