Thumbnail: javascript

Starting Out With jQuery/Javascript

by on under javascript
1 minute read

Find the Longest Word

function findLongestWord(words) {
    var sortArr = words.sort(function(a,b){
      return b.length - a.length;
    });
    return sortArr[0];
  }

With this little function the largest word in an array is returned. Only a few lines of code can do so much, this function clearly exemplifies the power of the Javascript programming language.

work, with, javscript, jquery