Skip to content

Commit c501ba5

Browse files
authored
Merge pull request vJechsmayr#185 from LorTrindade/feature/001_Length_Last_Word_lortrindade
length last word code
2 parents 4f49050 + 560a0ed commit c501ba5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @param {string} s
3+
* @return {number}
4+
*/
5+
var lengthOfLastWord = function(s) {
6+
var separe = s.trim().split(" ");
7+
return lastIndex = separe[separe.length -1].length;
8+
};

0 commit comments

Comments
 (0)