parsefloat

Benchmark created on


Setup

function safeParseFloat(val) {
	if (typeof val === "number") return val
	return parseFloat(val)
}

Test runner

Ready to run.

Testing in
TestOps/sec
num
parseFloat(42.23)
ready
str
parseFloat("42.23")
ready
safe num
safeParseFloat(42.42)
ready
safe str
safeParseFloat("42.42")
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.