This looks like a better version from a performance perspective for sure, I did this implementation of the same
function captilizeAllWords(s) { var capitalize = true; var returnValue = ''; for (var i = 0; i < s.length; ++i) { var c = s[i]; if (c == ' ') { capitalize = true; } else if (capitalize) { c = c.toUpperCase(); capitalize = false; } returnValue += c; } return returnValue; }
In an article I wrote here a few days ago: dev.to/anders/why-do-we-write-java...
Given that "of" seems like it may be a little slow this is probably even faster.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This looks like a better version from a performance perspective for sure, I did this implementation of the same
In an article I wrote here a few days ago: dev.to/anders/why-do-we-write-java...
Given that "of" seems like it may be a little slow this is probably even faster.