HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
 
function capitalizeFirstLetter(string) {
  return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
}
Tests:
  • lodash capitalize

     
    const text = "SoMe TeXt To CaPiTaLiZe";
    _.capitalize(text)
  • my own capalize

     
    const text = "SoMe TeXt To CaPiTaLiZe";
    capitalizeFirstLetter(text)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    lodash capitalize
    my own capalize

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 29 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0
Chrome 134 on Windows
View result in a separate tab
Test name Executions per second
lodash capitalize 15585363.0 Ops/sec
my own capalize 23586286.0 Ops/sec