isHexColorString-001

JavaScript performance comparison

Test case created by Jonathan Barronville

Preparation code

<script>
function isHexColorString1(a){"use strict";return"[object String]"!=={}.toString.call(a)?!1:(a=a.trim(),a=a.toLowerCase(),/^[0-9a-f]{6}$/.test(a)?!0:!1)}
function isHexColorString2(a){"use strict";return"[object String]"!=={}.toString.call(a)?!1:(a=a.trim(),/^[0-9a-fA-F]{6}$/.test(a)?!0:!1)}
function isHexColorString3(a){"use strict";return"[object String]"!=={}.toString.call(a)?!1:(a=a.trim(),/^[0-9a-f]{6}$/i.test(a)?!0:!1)}
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
001
isHexColorString1( '00aAfF' );
pending…
002
isHexColorString2( '00aAfF' );
pending…
003
isHexColorString3( '00aAfF' );
pending…

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

Compare results of other browsers

0 comments

Add a comment