{"id":16945831,"url":"https://github.com/jokeyrhyme/js-sub-array-tests","last_synced_at":"2026-05-09T06:37:05.201Z","repository":{"id":8440972,"uuid":"10032189","full_name":"jokeyrhyme/js-sub-array-tests","owner":"jokeyrhyme","description":"tests to compare different methods of sub-prototyping Array","archived":false,"fork":false,"pushed_at":"2016-12-16T04:15:10.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T21:48:26.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"highsea/Hosts","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jokeyrhyme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-13T13:27:47.000Z","updated_at":"2015-03-07T00:53:53.000Z","dependencies_parsed_at":"2022-08-23T16:40:49.657Z","dependency_job_id":null,"html_url":"https://github.com/jokeyrhyme/js-sub-array-tests","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jokeyrhyme/js-sub-array-tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jokeyrhyme%2Fjs-sub-array-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jokeyrhyme%2Fjs-sub-array-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jokeyrhyme%2Fjs-sub-array-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jokeyrhyme%2Fjs-sub-array-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jokeyrhyme","download_url":"https://codeload.github.com/jokeyrhyme/js-sub-array-tests/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jokeyrhyme%2Fjs-sub-array-tests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32810059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T21:23:57.043Z","updated_at":"2026-05-09T06:37:05.186Z","avatar_url":"https://github.com/jokeyrhyme.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js_sub_array_tests\n\nI put this together to test out some of the advice provided in this excellent\narticle:\nhttp://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/\n\nI wanted to see how much of this was still true, several years on. This advice\nwas also provided mostly for web browsers, and I wanted to see how Node.JS\naffected the outcomes.\n\n## Getting Started\n\nYou'll need the CLI module for [grunt](http://gruntjs.com) installed globally:\n\n    npm install -g grunt-cli\n\nIn the project root, run:\n\n    npm install\n\nThat will install the npm modules required for running the unit tests.\n\nOnce that's done, you can run the Node.JS unit tests with:\n\n    grunt\n\nor:\n\n    grunt test\n\nAdditionally, you may run the browser-based tests with:\n\n    grunt browser\n\nalthough these tests are more interesting if actually opened in real browsers.\nIn fact, the PhantomJS + Mocha combination for these browser tests doesn't\nreally work that well in Node.JS, so grab a browser.\n\n## Results\n\n### Node.JS\n\n- `grunt test` with Node.JS v0.10.5\n\n- tests confirm Array-detectability, if manipulating length effects indices as\nexpected, and if manipulating indices effects length as expected\n\n                | proper [[Class]] | length \u003e indices | indices \u003e length\n--------------- | ---------------- | ---------------- | -----------\nnaive           | no               | yes              | no\nstack           | no               | yes              | no\nmakeSubArray    | no               | yes              | yes\nwrapper: direct | yes              | yes              | yes\n\nThis is quite different to @kangax's [original results](http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/#summary).\nI can only guess that V8 does things differently compared to the browser JavaScript engines that were used in the original comparision.\n\n### Google Chrome\n\n- browser tests run in Chromium 26\n\n- same results as Node.JS\n\nIt isn't surprising the Chrome repeats the Node.JS results, as they both use V8.\n\n### Mozilla Firefox\n\n- browser tests run in Firefox 20\n\n- same results as Node.JS\n\nFirefox's JavaScript engine is a modern ECMAScript 5.1 engine, just like V8.\nI'm starting to sense a pattern here.\n\n### Internet Explorer\n\n- browser tests run in Microsoft Internet Explorer 10\n\n- same results as the others\n\n## License\nCopyright (c) 2013 Ron Waldon  \nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjokeyrhyme%2Fjs-sub-array-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjokeyrhyme%2Fjs-sub-array-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjokeyrhyme%2Fjs-sub-array-tests/lists"}