{"action":"created","comment":{"url":"https://api.github.com/repos/mobify/mobify-code-style/pulls/comments/41193890","id":41193890,"diff_hunk":"@@ -382,3 +382,21 @@ if (\"0\" == false) {console.log('foo')} // this will console log! bad!\n // good\n if (\"0\" === false) {console.log('foo')}\n ```\n+\n+##Calling array methods on array-like objects\n+\n+Use functions on Array.prototype for array-like objects. (eg. 'arguments' is not an array, but \n+is array-like).\n+\n+###Prefer using methods from `[]` over `Array.prototype`\n+\n+Performance between the two styles is almost identical. Prefer the short, more succinct version.\n+\n+```javascript\n+// Good\n+[].slice.call(arguments); ","path":"javascript/README.md","position":16,"original_position":16,"commit_id":"6e151623bb3cda14eb312e4466a72b6d98902bee","original_commit_id":"6e151623bb3cda14eb312e4466a72b6d98902bee","user":{"login":"jeremywiebe","id":77138,"avatar_url":"https://avatars.githubusercontent.com/u/77138?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremywiebe","html_url":"https://github.com/jeremywiebe","followers_url":"https://api.github.com/users/jeremywiebe/followers","following_url":"https://api.github.com/users/jeremywiebe/following{/other_user}","gists_url":"https://api.github.com/users/jeremywiebe/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremywiebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremywiebe/subscriptions","organizations_url":"https://api.github.com/users/jeremywiebe/orgs","repos_url":"https://api.github.com/users/jeremywiebe/repos","events_url":"https://api.github.com/users/jeremywiebe/events{/privacy}","received_events_url":"https://api.github.com/users/jeremywiebe/received_events","type":"User","site_admin":false},"body":"Just tried it, and that doesn't seem to work.  I believe the correct syntax is to pass `arguments` as the first call, as it's \"array-like\".\r\n```\r\n> var x = function() {\r\n... var y = [].slice.call(arguments);\r\n... console.log(\"Result: \" + y);\r\n... }\r\nundefined\r\n> x(29392,2,2,2)\r\nResult: 29392,2,2,2\r\nundefined\r\n> var x = function() {\r\n... var y = [].slice.call(null, arguments);\r\n... console.log(\"Result: \" + y);\r\n... }\r\nundefined\r\n> x(2,3,4)\r\nTypeError: Array.prototype.slice called on null or undefined\r\n    at x (repl:2:18)\r\n    at repl:1:1\r\n    at REPLServer.defaultEval (repl.js:164:27)\r\n    at bound (domain.js:250:14)\r\n    at REPLServer.runBound [as eval] (domain.js:263:12)\r\n    at REPLServer.<anonymous> (repl.js:393:12)\r\n    at emitOne (events.js:82:20)\r\n    at REPLServer.emit (events.js:169:7)\r\n    at REPLServer.Interface._onLine (readline.js:210:10)\r\n    at REPLServer.Interface._line (readline.js:549:8)\r\n```","created_at":"2015-10-05T20:34:41Z","updated_at":"2015-10-05T20:34:41Z","html_url":"https://github.com/mobify/mobify-code-style/pull/70#discussion_r41193890","pull_request_url":"https://api.github.com/repos/mobify/mobify-code-style/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/mobify/mobify-code-style/pulls/comments/41193890"},"html":{"href":"https://github.com/mobify/mobify-code-style/pull/70#discussion_r41193890"},"pull_request":{"href":"https://api.github.com/repos/mobify/mobify-code-style/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/mobify/mobify-code-style/pulls/70","id":46827480,"html_url":"https://github.com/mobify/mobify-code-style/pull/70","diff_url":"https://github.com/mobify/mobify-code-style/pull/70.diff","patch_url":"https://github.com/mobify/mobify-code-style/pull/70.patch","issue_url":"https://api.github.com/repos/mobify/mobify-code-style/issues/70","number":70,"state":"open","locked":false,"title":"Notes from Effective JavaScript Chapter 5","user":{"login":"jeremywiebe","id":77138,"avatar_url":"https://avatars.githubusercontent.com/u/77138?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremywiebe","html_url":"https://github.com/jeremywiebe","followers_url":"https://api.github.com/users/jeremywiebe/followers","following_url":"https://api.github.com/users/jeremywiebe/following{/other_user}","gists_url":"https://api.github.com/users/jeremywiebe/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremywiebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremywiebe/subscriptions","organizations_url":"https://api.github.com/users/jeremywiebe/orgs","repos_url":"https://api.github.com/users/jeremywiebe/repos","events_url":"https://api.github.com/users/jeremywiebe/events{/privacy}","received_events_url":"https://api.github.com/users/jeremywiebe/received_events","type":"User","site_admin":false},"body":"Adds one new rule based on book club discussion.\r\n  \r\nReviewers: @jansepar @spiside @noahadams @fractaltheory @haroldtreen \r\n~~JIRA: N/A~~\r\n~~Linked PRs: N/A~~\r\n  \r\n## Changes\r\n- Add rule \"Prefer `[].forEach.call(some_array_like_object);` over `Array.prototype.forEach.call(some_array_like_object);`.\"\r\n  \r\n## How to test-drive this PR\r\n- Read the docs\r\n  \r\n## Research resources\r\n- http://jsperf.com/foreach-vs-array-prototype-foreach\r\n ","created_at":"2015-10-05T20:12:25Z","updated_at":"2015-10-05T20:34:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"432e8308ff212ba24796c31aa65834a584fd750f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mobify/mobify-code-style/pulls/70/commits","review_comments_url":"https://api.github.com/repos/mobify/mobify-code-style/pulls/70/comments","review_comment_url":"https://api.github.com/repos/mobify/mobify-code-style/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mobify/mobify-code-style/issues/70/comments","statuses_url":"https://api.github.com/repos/mobify/mobify-code-style/statuses/6e151623bb3cda14eb312e4466a72b6d98902bee","head":{"label":"mobify:effective-javascript-ch5","ref":"effective-javascript-ch5","sha":"6e151623bb3cda14eb312e4466a72b6d98902bee","user":{"login":"mobify","id":73539,"avatar_url":"https://avatars.githubusercontent.com/u/73539?v=3","gravatar_id":"","url":"https://api.github.com/users/mobify","html_url":"https://github.com/mobify","followers_url":"https://api.github.com/users/mobify/followers","following_url":"https://api.github.com/users/mobify/following{/other_user}","gists_url":"https://api.github.com/users/mobify/gists{/gist_id}","starred_url":"https://api.github.com/users/mobify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobify/subscriptions","organizations_url":"https://api.github.com/users/mobify/orgs","repos_url":"https://api.github.com/users/mobify/repos","events_url":"https://api.github.com/users/mobify/events{/privacy}","received_events_url":"https://api.github.com/users/mobify/received_events","type":"Organization","site_admin":false},"repo":{"id":19261065,"name":"mobify-code-style","full_name":"mobify/mobify-code-style","owner":{"login":"mobify","id":73539,"avatar_url":"https://avatars.githubusercontent.com/u/73539?v=3","gravatar_id":"","url":"https://api.github.com/users/mobify","html_url":"https://github.com/mobify","followers_url":"https://api.github.com/users/mobify/followers","following_url":"https://api.github.com/users/mobify/following{/other_user}","gists_url":"https://api.github.com/users/mobify/gists{/gist_id}","starred_url":"https://api.github.com/users/mobify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobify/subscriptions","organizations_url":"https://api.github.com/users/mobify/orgs","repos_url":"https://api.github.com/users/mobify/repos","events_url":"https://api.github.com/users/mobify/events{/privacy}","received_events_url":"https://api.github.com/users/mobify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mobify/mobify-code-style","description":"A place to define coding style and standards","fork":false,"url":"https://api.github.com/repos/mobify/mobify-code-style","forks_url":"https://api.github.com/repos/mobify/mobify-code-style/forks","keys_url":"https://api.github.com/repos/mobify/mobify-code-style/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mobify/mobify-code-style/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mobify/mobify-code-style/teams","hooks_url":"https://api.github.com/repos/mobify/mobify-code-style/hooks","issue_events_url":"https://api.github.com/repos/mobify/mobify-code-style/issues/events{/number}","events_url":"https://api.github.com/repos/mobify/mobify-code-style/events","assignees_url":"https://api.github.com/repos/mobify/mobify-code-style/assignees{/user}","branches_url":"https://api.github.com/repos/mobify/mobify-code-style/branches{/branch}","tags_url":"https://api.github.com/repos/mobify/mobify-code-style/tags","blobs_url":"https://api.github.com/repos/mobify/mobify-code-style/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mobify/mobify-code-style/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mobify/mobify-code-style/git/refs{/sha}","trees_url":"https://api.github.com/repos/mobify/mobify-code-style/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mobify/mobify-code-style/statuses/{sha}","languages_url":"https://api.github.com/repos/mobify/mobify-code-style/languages","stargazers_url":"https://api.github.com/repos/mobify/mobify-code-style/stargazers","contributors_url":"https://api.github.com/repos/mobify/mobify-code-style/contributors","subscribers_url":"https://api.github.com/repos/mobify/mobify-code-style/subscribers","subscription_url":"https://api.github.com/repos/mobify/mobify-code-style/subscription","commits_url":"https://api.github.com/repos/mobify/mobify-code-style/commits{/sha}","git_commits_url":"https://api.github.com/repos/mobify/mobify-code-style/git/commits{/sha}","comments_url":"https://api.github.com/repos/mobify/mobify-code-style/comments{/number}","issue_comment_url":"https://api.github.com/repos/mobify/mobify-code-style/issues/comments{/number}","contents_url":"https://api.github.com/repos/mobify/mobify-code-style/contents/{+path}","compare_url":"https://api.github.com/repos/mobify/mobify-code-style/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mobify/mobify-code-style/merges","archive_url":"https://api.github.com/repos/mobify/mobify-code-style/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mobify/mobify-code-style/downloads","issues_url":"https://api.github.com/repos/mobify/mobify-code-style/issues{/number}","pulls_url":"https://api.github.com/repos/mobify/mobify-code-style/pulls{/number}","milestones_url":"https://api.github.com/repos/mobify/mobify-code-style/milestones{/number}","notifications_url":"https://api.github.com/repos/mobify/mobify-code-style/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mobify/mobify-code-style/labels{/name}","releases_url":"https://api.github.com/repos/mobify/mobify-code-style/releases{/id}","created_at":"2014-04-29T02:27:15Z","updated_at":"2015-10-04T19:31:41Z","pushed_at":"2015-10-05T20:15:16Z","git_url":"git://github.com/mobify/mobify-code-style.git","ssh_url":"git@github.com:mobify/mobify-code-style.git","clone_url":"https://github.com/mobify/mobify-code-style.git","svn_url":"https://github.com/mobify/mobify-code-style","homepage":null,"size":1141,"stargazers_count":39,"watchers_count":39,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":11,"forks":5,"open_issues":11,"watchers":39,"default_branch":"master"}},"base":{"label":"mobify:master","ref":"master","sha":"4a96e85ef4dcfe8e3440051e2499639924afdca4","user":{"login":"mobify","id":73539,"avatar_url":"https://avatars.githubusercontent.com/u/73539?v=3","gravatar_id":"","url":"https://api.github.com/users/mobify","html_url":"https://github.com/mobify","followers_url":"https://api.github.com/users/mobify/followers","following_url":"https://api.github.com/users/mobify/following{/other_user}","gists_url":"https://api.github.com/users/mobify/gists{/gist_id}","starred_url":"https://api.github.com/users/mobify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobify/subscriptions","organizations_url":"https://api.github.com/users/mobify/orgs","repos_url":"https://api.github.com/users/mobify/repos","events_url":"https://api.github.com/users/mobify/events{/privacy}","received_events_url":"https://api.github.com/users/mobify/received_events","type":"Organization","site_admin":false},"repo":{"id":19261065,"name":"mobify-code-style","full_name":"mobify/mobify-code-style","owner":{"login":"mobify","id":73539,"avatar_url":"https://avatars.githubusercontent.com/u/73539?v=3","gravatar_id":"","url":"https://api.github.com/users/mobify","html_url":"https://github.com/mobify","followers_url":"https://api.github.com/users/mobify/followers","following_url":"https://api.github.com/users/mobify/following{/other_user}","gists_url":"https://api.github.com/users/mobify/gists{/gist_id}","starred_url":"https://api.github.com/users/mobify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobify/subscriptions","organizations_url":"https://api.github.com/users/mobify/orgs","repos_url":"https://api.github.com/users/mobify/repos","events_url":"https://api.github.com/users/mobify/events{/privacy}","received_events_url":"https://api.github.com/users/mobify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mobify/mobify-code-style","description":"A place to define coding style and standards","fork":false,"url":"https://api.github.com/repos/mobify/mobify-code-style","forks_url":"https://api.github.com/repos/mobify/mobify-code-style/forks","keys_url":"https://api.github.com/repos/mobify/mobify-code-style/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mobify/mobify-code-style/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mobify/mobify-code-style/teams","hooks_url":"https://api.github.com/repos/mobify/mobify-code-style/hooks","issue_events_url":"https://api.github.com/repos/mobify/mobify-code-style/issues/events{/number}","events_url":"https://api.github.com/repos/mobify/mobify-code-style/events","assignees_url":"https://api.github.com/repos/mobify/mobify-code-style/assignees{/user}","branches_url":"https://api.github.com/repos/mobify/mobify-code-style/branches{/branch}","tags_url":"https://api.github.com/repos/mobify/mobify-code-style/tags","blobs_url":"https://api.github.com/repos/mobify/mobify-code-style/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mobify/mobify-code-style/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mobify/mobify-code-style/git/refs{/sha}","trees_url":"https://api.github.com/repos/mobify/mobify-code-style/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mobify/mobify-code-style/statuses/{sha}","languages_url":"https://api.github.com/repos/mobify/mobify-code-style/languages","stargazers_url":"https://api.github.com/repos/mobify/mobify-code-style/stargazers","contributors_url":"https://api.github.com/repos/mobify/mobify-code-style/contributors","subscribers_url":"https://api.github.com/repos/mobify/mobify-code-style/subscribers","subscription_url":"https://api.github.com/repos/mobify/mobify-code-style/subscription","commits_url":"https://api.github.com/repos/mobify/mobify-code-style/commits{/sha}","git_commits_url":"https://api.github.com/repos/mobify/mobify-code-style/git/commits{/sha}","comments_url":"https://api.github.com/repos/mobify/mobify-code-style/comments{/number}","issue_comment_url":"https://api.github.com/repos/mobify/mobify-code-style/issues/comments{/number}","contents_url":"https://api.github.com/repos/mobify/mobify-code-style/contents/{+path}","compare_url":"https://api.github.com/repos/mobify/mobify-code-style/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mobify/mobify-code-style/merges","archive_url":"https://api.github.com/repos/mobify/mobify-code-style/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mobify/mobify-code-style/downloads","issues_url":"https://api.github.com/repos/mobify/mobify-code-style/issues{/number}","pulls_url":"https://api.github.com/repos/mobify/mobify-code-style/pulls{/number}","milestones_url":"https://api.github.com/repos/mobify/mobify-code-style/milestones{/number}","notifications_url":"https://api.github.com/repos/mobify/mobify-code-style/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mobify/mobify-code-style/labels{/name}","releases_url":"https://api.github.com/repos/mobify/mobify-code-style/releases{/id}","created_at":"2014-04-29T02:27:15Z","updated_at":"2015-10-04T19:31:41Z","pushed_at":"2015-10-05T20:15:16Z","git_url":"git://github.com/mobify/mobify-code-style.git","ssh_url":"git@github.com:mobify/mobify-code-style.git","clone_url":"https://github.com/mobify/mobify-code-style.git","svn_url":"https://github.com/mobify/mobify-code-style","homepage":null,"size":1141,"stargazers_count":39,"watchers_count":39,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":11,"forks":5,"open_issues":11,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mobify/mobify-code-style/pulls/70"},"html":{"href":"https://github.com/mobify/mobify-code-style/pull/70"},"issue":{"href":"https://api.github.com/repos/mobify/mobify-code-style/issues/70"},"comments":{"href":"https://api.github.com/repos/mobify/mobify-code-style/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/mobify/mobify-code-style/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/mobify/mobify-code-style/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mobify/mobify-code-style/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/mobify/mobify-code-style/statuses/6e151623bb3cda14eb312e4466a72b6d98902bee"}}}}