由于题目明确给出了字符串是以空格分隔的,所以可以直接用JavaScript中字符串自带的方法split进行切分,然后弹出数组中最后一个单词取长度即可。唯一需要注意的是句子前后可能有空格,所以split之前要trim一次。
Repository navigation
058.LengthOfLastWord
Directory actions
More options
Directory actions
More options
058.LengthOfLastWord
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||