Undefined Check

JavaScript performance comparison

Revision 2 of this test case created

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Check w/ RegExp
if (/^u/.test(typeof define)) {
  define = function() { };
}
pending…
Check w/ charAt(0)
if ((typeof define).charAt(0)!=='u') {
  define = function() {};
}
pending…
Check w/ string indexer
// Accessing characters as numeric properties of a string is non-standard
// prior to ECMAScript 5 and doesn't work in all browsers. (eg, IE6 e IE7)
if ((typeof define)[0]!=='u') {
  define = function() {};
}
pending…
Check w/ in operator
if (!this.define) {
  define = function() {};
}
pending…
General check
if ( typeof define === "undefined" ) {
   define = function() {};
}
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. Here’s a list of current revisions for this page:

0 comments

Add a comment