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
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.
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.