Answers for "return he longest string javascript"

6

find length of longest string in array javascript

const findLongest = words => Math.max(...(words.map(el => el.length)));

// Example
findLongest(['always','look','on','the','bright','side','of','life']);  // 6
Posted by: Guest on July-02-2020
2

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 "));
Posted by: Guest on October-18-2020
0

js find longest vword

function findLongestWord(str) {
  var longestWord = str.split(' ').sort(function(a, b) { return b.length - a.length; });
  return longestWord[0].length;
}
findLongestWord("The quick brown fox jumped over the lazy dog");
Posted by: Guest on October-15-2020

Code answers related to "return he longest string javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language