Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort and split js alefbethic

 function splitAndSort(s){
         
         const ALPHA_REGEX = /^[a-zA-Z]+$/i

         let isAlphaWord = (word) => ALPHA_REGEX.test(word)
         let alphas = s
         .replace(/[^a-zA-Z ]/gi,"")
         .split(' ')
         .filter(isAlphaWord)   
         
         alphas = alphas.filter(w=>w.length >1)
         alphas.sort()
         return alphas 

     }
 
PREVIOUS NEXT
Tagged: #sort #split #js #alefbethic
ADD COMMENT
Topic
Name
3+8 =