numberify

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
test1
function f1(s) {
 var b = parseFloat(s);;
 if (b == s) {
  return s;
 } else {
  var x = b >> 0;
  return s.replace(/\./g, '').replace(x, x + '.');
 }
}
ready
test2
function f2(s) {
 var c = 0;
 return parseFloat(s.replace(/\./g, function() {
  return (c++ === 0) ? '.' : '';
 }));
}
ready

Revisions

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