typeArray.js 394 B

123456789101112131415161718192021222324
  1. "use strict";
  2. // benchmark ways to check if is an Array
  3. // setup
  4. var arr = [];
  5. // tests
  6. exports.typeArray = {
  7. "instanceof check": function() {
  8. arr instanceof Array;
  9. },
  10. "typeof check, constructor check": function() {
  11. typeof arr === "object" && arr.constructor === Array;
  12. },
  13. };
  14. // if run directly run benchmarks
  15. if (!module.main) return require("benchmarksman").runner(exports);