Convert a string to a number using JavaScript

JavaScript performance comparison

Test case created by completejavascript

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Plus
const x = +"6666";
pending…
Number
const x = Number("6666");
pending…
Math.floor
const x = Math.floor("6666");
pending…
ParseInt
const x = parseInt("6666", 10);
pending…
Mul
const x = "1000"*1;
pending…
Bitwise not
const x = ~~"6666"
pending…
Diving by one
const x = "6666" / 1;
pending…
Minus 0
const x = "6666" - 0;
pending…

Compare results of other browsers

Revisions

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

0 Comments