Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function returnLongestWord(string){
- var temp = 0;
- var tempWord;
- var split = string.split(' ');
- for(var i=0, len = split.length; i<len; i++){
- if( temp < split[i].length ) {
- temp = split[i].length;
- tempWord = split[i];
- }
- }
- return tempWord;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement