{"action":"created","comment":{"url":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/comments/35236836","id":35236836,"diff_hunk":"@@ -143,6 +179,131 @@ algorithms that might grow the call stack boundlessly.\n Aggregate operations provide forms for iterating over collections that are more\n precise and oftentimes more useful than their procedural alternatives.\n \n+## Object-orientation\n+\n+You can leverage object-oriented design patterns such as encapsulation,\n+composition, and inheritance in JavaScript. Create functions whose instance\n+variables represent private and protected members. From these functions, return\n+objects with methods to access and possibly manipulate the instance\n+variables. Create functions with extended interfaces that mutate instances of\n+their parents to effect inheritance.\n+\n+Example:\n+\n+```js\n+var makeMammal = function (data) {\n+    var self = {};\n+    self.getName = function () {\n+        return data.name;\n+    };\n+    self.says = function () {\n+        return data.saying === undefined ? '' : data.saying;\n+    };\n+    return self;\n+};\n+\n+var myMammal = makeMammal({name: 'Herb'});\n+\n+var makeCat = function (data) {\n+    var self;\n+    data.saying = data.saying === undefined ? 'meow' : data.saying;\n+    self = makeMammal(data);\n+    self.purr = function (n) {\n+        var message = '',\n+            index;\n+        for (index = 0; index < n; index += 1) {","path":"javascript-style-guide.md","position":201,"original_position":201,"commit_id":"9bdde79500a06a1a1bf5aef79115f97a5c0c5f2e","original_commit_id":"9bdde79500a06a1a1bf5aef79115f97a5c0c5f2e","user":{"login":"whenther","id":5178425,"avatar_url":"https://avatars.githubusercontent.com/u/5178425?v=3","gravatar_id":"","url":"https://api.github.com/users/whenther","html_url":"https://github.com/whenther","followers_url":"https://api.github.com/users/whenther/followers","following_url":"https://api.github.com/users/whenther/following{/other_user}","gists_url":"https://api.github.com/users/whenther/gists{/gist_id}","starred_url":"https://api.github.com/users/whenther/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whenther/subscriptions","organizations_url":"https://api.github.com/users/whenther/orgs","repos_url":"https://api.github.com/users/whenther/repos","events_url":"https://api.github.com/users/whenther/events{/privacy}","received_events_url":"https://api.github.com/users/whenther/received_events","type":"User","site_admin":false},"body":"Hey now, ```Prefer `forEach`, `map`, `filter` and `reduce` over `for` loops.```","created_at":"2015-07-22T17:04:47Z","updated_at":"2015-07-22T17:04:47Z","html_url":"https://github.com/StoryCloud/code-style-guides/pull/1#discussion_r35236836","pull_request_url":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/comments/35236836"},"html":{"href":"https://github.com/StoryCloud/code-style-guides/pull/1#discussion_r35236836"},"pull_request":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/1","id":40540546,"html_url":"https://github.com/StoryCloud/code-style-guides/pull/1","diff_url":"https://github.com/StoryCloud/code-style-guides/pull/1.diff","patch_url":"https://github.com/StoryCloud/code-style-guides/pull/1.patch","issue_url":"https://api.github.com/repos/StoryCloud/code-style-guides/issues/1","number":1,"state":"open","locked":false,"title":"Feature/modernization","user":{"login":"jacksonrayhamilton","id":5356588,"avatar_url":"https://avatars.githubusercontent.com/u/5356588?v=3","gravatar_id":"","url":"https://api.github.com/users/jacksonrayhamilton","html_url":"https://github.com/jacksonrayhamilton","followers_url":"https://api.github.com/users/jacksonrayhamilton/followers","following_url":"https://api.github.com/users/jacksonrayhamilton/following{/other_user}","gists_url":"https://api.github.com/users/jacksonrayhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/jacksonrayhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacksonrayhamilton/subscriptions","organizations_url":"https://api.github.com/users/jacksonrayhamilton/orgs","repos_url":"https://api.github.com/users/jacksonrayhamilton/repos","events_url":"https://api.github.com/users/jacksonrayhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/jacksonrayhamilton/received_events","type":"User","site_admin":false},"body":"I realized these style guides were bit dated in respect to ECMAScript 6 and to some of our evolved conventions, so I brought it up to speed. I've also added an example of how I'd like to do object-orientation, which I have alluded to in the past, but I haven't had many good examples to point at.","created_at":"2015-07-22T08:20:27Z","updated_at":"2015-07-22T17:04:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8098933a5b481267a2e5fad540c33a263ff6c967","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/1/commits","review_comments_url":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/1/comments","review_comment_url":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StoryCloud/code-style-guides/issues/1/comments","statuses_url":"https://api.github.com/repos/StoryCloud/code-style-guides/statuses/9bdde79500a06a1a1bf5aef79115f97a5c0c5f2e","head":{"label":"StoryCloud:feature/modernization","ref":"feature/modernization","sha":"9bdde79500a06a1a1bf5aef79115f97a5c0c5f2e","user":{"login":"StoryCloud","id":6538520,"avatar_url":"https://avatars.githubusercontent.com/u/6538520?v=3","gravatar_id":"","url":"https://api.github.com/users/StoryCloud","html_url":"https://github.com/StoryCloud","followers_url":"https://api.github.com/users/StoryCloud/followers","following_url":"https://api.github.com/users/StoryCloud/following{/other_user}","gists_url":"https://api.github.com/users/StoryCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/StoryCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoryCloud/subscriptions","organizations_url":"https://api.github.com/users/StoryCloud/orgs","repos_url":"https://api.github.com/users/StoryCloud/repos","events_url":"https://api.github.com/users/StoryCloud/events{/privacy}","received_events_url":"https://api.github.com/users/StoryCloud/received_events","type":"Organization","site_admin":false},"repo":{"id":30793817,"name":"code-style-guides","full_name":"StoryCloud/code-style-guides","owner":{"login":"StoryCloud","id":6538520,"avatar_url":"https://avatars.githubusercontent.com/u/6538520?v=3","gravatar_id":"","url":"https://api.github.com/users/StoryCloud","html_url":"https://github.com/StoryCloud","followers_url":"https://api.github.com/users/StoryCloud/followers","following_url":"https://api.github.com/users/StoryCloud/following{/other_user}","gists_url":"https://api.github.com/users/StoryCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/StoryCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoryCloud/subscriptions","organizations_url":"https://api.github.com/users/StoryCloud/orgs","repos_url":"https://api.github.com/users/StoryCloud/repos","events_url":"https://api.github.com/users/StoryCloud/events{/privacy}","received_events_url":"https://api.github.com/users/StoryCloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StoryCloud/code-style-guides","description":"Guidelines for consistent and correct code","fork":false,"url":"https://api.github.com/repos/StoryCloud/code-style-guides","forks_url":"https://api.github.com/repos/StoryCloud/code-style-guides/forks","keys_url":"https://api.github.com/repos/StoryCloud/code-style-guides/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StoryCloud/code-style-guides/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StoryCloud/code-style-guides/teams","hooks_url":"https://api.github.com/repos/StoryCloud/code-style-guides/hooks","issue_events_url":"https://api.github.com/repos/StoryCloud/code-style-guides/issues/events{/number}","events_url":"https://api.github.com/repos/StoryCloud/code-style-guides/events","assignees_url":"https://api.github.com/repos/StoryCloud/code-style-guides/assignees{/user}","branches_url":"https://api.github.com/repos/StoryCloud/code-style-guides/branches{/branch}","tags_url":"https://api.github.com/repos/StoryCloud/code-style-guides/tags","blobs_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/refs{/sha}","trees_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StoryCloud/code-style-guides/statuses/{sha}","languages_url":"https://api.github.com/repos/StoryCloud/code-style-guides/languages","stargazers_url":"https://api.github.com/repos/StoryCloud/code-style-guides/stargazers","contributors_url":"https://api.github.com/repos/StoryCloud/code-style-guides/contributors","subscribers_url":"https://api.github.com/repos/StoryCloud/code-style-guides/subscribers","subscription_url":"https://api.github.com/repos/StoryCloud/code-style-guides/subscription","commits_url":"https://api.github.com/repos/StoryCloud/code-style-guides/commits{/sha}","git_commits_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/commits{/sha}","comments_url":"https://api.github.com/repos/StoryCloud/code-style-guides/comments{/number}","issue_comment_url":"https://api.github.com/repos/StoryCloud/code-style-guides/issues/comments{/number}","contents_url":"https://api.github.com/repos/StoryCloud/code-style-guides/contents/{+path}","compare_url":"https://api.github.com/repos/StoryCloud/code-style-guides/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StoryCloud/code-style-guides/merges","archive_url":"https://api.github.com/repos/StoryCloud/code-style-guides/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StoryCloud/code-style-guides/downloads","issues_url":"https://api.github.com/repos/StoryCloud/code-style-guides/issues{/number}","pulls_url":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls{/number}","milestones_url":"https://api.github.com/repos/StoryCloud/code-style-guides/milestones{/number}","notifications_url":"https://api.github.com/repos/StoryCloud/code-style-guides/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StoryCloud/code-style-guides/labels{/name}","releases_url":"https://api.github.com/repos/StoryCloud/code-style-guides/releases{/id}","created_at":"2015-02-14T10:35:59Z","updated_at":"2015-06-16T21:30:46Z","pushed_at":"2015-07-22T08:28:58Z","git_url":"git://github.com/StoryCloud/code-style-guides.git","ssh_url":"git@github.com:StoryCloud/code-style-guides.git","clone_url":"https://github.com/StoryCloud/code-style-guides.git","svn_url":"https://github.com/StoryCloud/code-style-guides","homepage":null,"size":164,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"develop"}},"base":{"label":"StoryCloud:develop","ref":"develop","sha":"a20aa6528ad2337c5f22b7d6a5fef76867451415","user":{"login":"StoryCloud","id":6538520,"avatar_url":"https://avatars.githubusercontent.com/u/6538520?v=3","gravatar_id":"","url":"https://api.github.com/users/StoryCloud","html_url":"https://github.com/StoryCloud","followers_url":"https://api.github.com/users/StoryCloud/followers","following_url":"https://api.github.com/users/StoryCloud/following{/other_user}","gists_url":"https://api.github.com/users/StoryCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/StoryCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoryCloud/subscriptions","organizations_url":"https://api.github.com/users/StoryCloud/orgs","repos_url":"https://api.github.com/users/StoryCloud/repos","events_url":"https://api.github.com/users/StoryCloud/events{/privacy}","received_events_url":"https://api.github.com/users/StoryCloud/received_events","type":"Organization","site_admin":false},"repo":{"id":30793817,"name":"code-style-guides","full_name":"StoryCloud/code-style-guides","owner":{"login":"StoryCloud","id":6538520,"avatar_url":"https://avatars.githubusercontent.com/u/6538520?v=3","gravatar_id":"","url":"https://api.github.com/users/StoryCloud","html_url":"https://github.com/StoryCloud","followers_url":"https://api.github.com/users/StoryCloud/followers","following_url":"https://api.github.com/users/StoryCloud/following{/other_user}","gists_url":"https://api.github.com/users/StoryCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/StoryCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StoryCloud/subscriptions","organizations_url":"https://api.github.com/users/StoryCloud/orgs","repos_url":"https://api.github.com/users/StoryCloud/repos","events_url":"https://api.github.com/users/StoryCloud/events{/privacy}","received_events_url":"https://api.github.com/users/StoryCloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StoryCloud/code-style-guides","description":"Guidelines for consistent and correct code","fork":false,"url":"https://api.github.com/repos/StoryCloud/code-style-guides","forks_url":"https://api.github.com/repos/StoryCloud/code-style-guides/forks","keys_url":"https://api.github.com/repos/StoryCloud/code-style-guides/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StoryCloud/code-style-guides/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StoryCloud/code-style-guides/teams","hooks_url":"https://api.github.com/repos/StoryCloud/code-style-guides/hooks","issue_events_url":"https://api.github.com/repos/StoryCloud/code-style-guides/issues/events{/number}","events_url":"https://api.github.com/repos/StoryCloud/code-style-guides/events","assignees_url":"https://api.github.com/repos/StoryCloud/code-style-guides/assignees{/user}","branches_url":"https://api.github.com/repos/StoryCloud/code-style-guides/branches{/branch}","tags_url":"https://api.github.com/repos/StoryCloud/code-style-guides/tags","blobs_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/refs{/sha}","trees_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StoryCloud/code-style-guides/statuses/{sha}","languages_url":"https://api.github.com/repos/StoryCloud/code-style-guides/languages","stargazers_url":"https://api.github.com/repos/StoryCloud/code-style-guides/stargazers","contributors_url":"https://api.github.com/repos/StoryCloud/code-style-guides/contributors","subscribers_url":"https://api.github.com/repos/StoryCloud/code-style-guides/subscribers","subscription_url":"https://api.github.com/repos/StoryCloud/code-style-guides/subscription","commits_url":"https://api.github.com/repos/StoryCloud/code-style-guides/commits{/sha}","git_commits_url":"https://api.github.com/repos/StoryCloud/code-style-guides/git/commits{/sha}","comments_url":"https://api.github.com/repos/StoryCloud/code-style-guides/comments{/number}","issue_comment_url":"https://api.github.com/repos/StoryCloud/code-style-guides/issues/comments{/number}","contents_url":"https://api.github.com/repos/StoryCloud/code-style-guides/contents/{+path}","compare_url":"https://api.github.com/repos/StoryCloud/code-style-guides/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StoryCloud/code-style-guides/merges","archive_url":"https://api.github.com/repos/StoryCloud/code-style-guides/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StoryCloud/code-style-guides/downloads","issues_url":"https://api.github.com/repos/StoryCloud/code-style-guides/issues{/number}","pulls_url":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls{/number}","milestones_url":"https://api.github.com/repos/StoryCloud/code-style-guides/milestones{/number}","notifications_url":"https://api.github.com/repos/StoryCloud/code-style-guides/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StoryCloud/code-style-guides/labels{/name}","releases_url":"https://api.github.com/repos/StoryCloud/code-style-guides/releases{/id}","created_at":"2015-02-14T10:35:59Z","updated_at":"2015-06-16T21:30:46Z","pushed_at":"2015-07-22T08:28:58Z","git_url":"git://github.com/StoryCloud/code-style-guides.git","ssh_url":"git@github.com:StoryCloud/code-style-guides.git","clone_url":"https://github.com/StoryCloud/code-style-guides.git","svn_url":"https://github.com/StoryCloud/code-style-guides","homepage":null,"size":164,"stargazers_count":2,"watchers_count":2,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/1"},"html":{"href":"https://github.com/StoryCloud/code-style-guides/pull/1"},"issue":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/issues/1"},"comments":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/StoryCloud/code-style-guides/statuses/9bdde79500a06a1a1bf5aef79115f97a5c0c5f2e"}}}}