Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Capitalize
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
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
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
3
83.3M/s
1
81.7M/s
2
18.1M/s
5
9.2M/s
4
9.0M/s
View exact numbers
Test name
Executions per second
✓
3
83,302,584 Ops/sec
1
81,682,360 Ops/sec
2
18,127,278 Ops/sec
5
9,151,775 Ops/sec
4
9,009,189 Ops/sec
Tests:
1
function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } capitalizeFirstLetter('string');
2
function capitalizeFirstLetter(string) { return string.replace(/^./, string[0].toUpperCase()); } capitalizeFirstLetter('string');
3
function capitalizeFirstLetter(string) { return string[0].toUpperCase() + string.slice(1); } capitalizeFirstLetter('string');
4
String.prototype.capitalizeFirstLetter = function() { return this.charAt(0).toUpperCase() + this.slice(1); } 'string'.capitalizeFirstLetter();
5
String.prototype.capitalizeFirstLetter = function() { return this[0].toUpperCase() + this.slice(1); } 'string'.capitalizeFirstLetter();