Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find longest word in string javascript

 function data(str){
           var show = str.split(" ");
            show.sort(function (a,b){
                return b.length - a.length; 
            })
            return show[0];
      }
      console.log(data(str = "javascript is my favourite language "));
 
PREVIOUS NEXT
Tagged: #find #longest #word #string #javascript
ADD COMMENT
Topic
Name
6+5 =