{"action":"created","comment":{"url":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/comments/46559928","id":46559928,"diff_hunk":"@@ -0,0 +1,148 @@\n+---\n+date: \"2015-12-08\"\n+title: \"ES6, ES2015 : les classes\"\n+tags:\n+  - javascript\n+  - ES6\n+  - ES2015\n+authors:\n+  - magsout\n+---\n+\n+Les classes introduites par `ES2015` ne sont clairement que du sucre syntaxique.\n+Elles n'apportent rien de plus en terme de fonctionnalité. Toutefois, l'objectif\n+de cette évolution est de rendre le code plus lisible et plus facilement\n+accessible.\n+\n+## Déclaration de classes\n+\n+Oubliez les fonctions anonymes et les prototypes, la sémantique a pris le\n+relais, comme vous pouvez le constater dans l'exemple de déclaration de la\n+classe `User` :\n+\n+```js\n+class User {\n+  // méthode constructor\n+  constructor(firstname, lastname) {\n+    this.firstname = firstname;\n+    this.lastname = lastname;\n+  }\n+\n+  sayName() {\n+    return `${this.firstname} ${this.lastname}`\n+  }\n+}\n+\n+// instanciation\n+const user = new User(\"John\", \"Doe\")\n+\n+// appel de la méthode sayName()\n+console.log(user.sayName()) // John Doe\n+```\n+\n+Pour rappelle, voici une [façon possible\n+d'écrire](https://gist.github.com/magsout/a876b2fa8240a987e523) cette classe en\n+`es5` :\n+\n+```js\n+var User = function(firstname, lastname) {\n+  this.firstname = firstname\n+  this.lastname = lastname\n+}\n+\n+User.prototype.sayName = function() {\n+  return(this.firstname + \" \" + this.lastname)","path":"content/fr/articles/js/es2015/classes.md","position":54,"original_position":54,"commit_id":"f77daeb4fa2da875436993c4b6f4d4dd412212be","original_commit_id":"f77daeb4fa2da875436993c4b6f4d4dd412212be","user":{"login":"bloodyowl","id":1688645,"avatar_url":"https://avatars.githubusercontent.com/u/1688645?v=3","gravatar_id":"","url":"https://api.github.com/users/bloodyowl","html_url":"https://github.com/bloodyowl","followers_url":"https://api.github.com/users/bloodyowl/followers","following_url":"https://api.github.com/users/bloodyowl/following{/other_user}","gists_url":"https://api.github.com/users/bloodyowl/gists{/gist_id}","starred_url":"https://api.github.com/users/bloodyowl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloodyowl/subscriptions","organizations_url":"https://api.github.com/users/bloodyowl/orgs","repos_url":"https://api.github.com/users/bloodyowl/repos","events_url":"https://api.github.com/users/bloodyowl/events{/privacy}","received_events_url":"https://api.github.com/users/bloodyowl/received_events","type":"User","site_admin":false},"body":"missing space","created_at":"2015-12-03T14:52:18Z","updated_at":"2015-12-03T14:52:18Z","html_url":"https://github.com/putaindecode/putaindecode.io/pull/564#discussion_r46559928","pull_request_url":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/564","_links":{"self":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/comments/46559928"},"html":{"href":"https://github.com/putaindecode/putaindecode.io/pull/564#discussion_r46559928"},"pull_request":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/564"}}},"pull_request":{"url":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/564","id":52450933,"html_url":"https://github.com/putaindecode/putaindecode.io/pull/564","diff_url":"https://github.com/putaindecode/putaindecode.io/pull/564.diff","patch_url":"https://github.com/putaindecode/putaindecode.io/pull/564.patch","issue_url":"https://api.github.com/repos/putaindecode/putaindecode.io/issues/564","number":564,"state":"open","locked":false,"title":"[Post] ES6 classes","user":{"login":"magsout","id":1997108,"avatar_url":"https://avatars.githubusercontent.com/u/1997108?v=3","gravatar_id":"","url":"https://api.github.com/users/magsout","html_url":"https://github.com/magsout","followers_url":"https://api.github.com/users/magsout/followers","following_url":"https://api.github.com/users/magsout/following{/other_user}","gists_url":"https://api.github.com/users/magsout/gists{/gist_id}","starred_url":"https://api.github.com/users/magsout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magsout/subscriptions","organizations_url":"https://api.github.com/users/magsout/orgs","repos_url":"https://api.github.com/users/magsout/repos","events_url":"https://api.github.com/users/magsout/events{/privacy}","received_events_url":"https://api.github.com/users/magsout/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-02T20:39:25Z","updated_at":"2015-12-03T14:52:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22fe673c9159a200b3d5a7532c7a1b8f346c3978","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/564/commits","review_comments_url":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/564/comments","review_comment_url":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/putaindecode/putaindecode.io/issues/564/comments","statuses_url":"https://api.github.com/repos/putaindecode/putaindecode.io/statuses/f77daeb4fa2da875436993c4b6f4d4dd412212be","head":{"label":"putaindecode:Post.ES6-Classes","ref":"Post.ES6-Classes","sha":"f77daeb4fa2da875436993c4b6f4d4dd412212be","user":{"login":"putaindecode","id":4541781,"avatar_url":"https://avatars.githubusercontent.com/u/4541781?v=3","gravatar_id":"","url":"https://api.github.com/users/putaindecode","html_url":"https://github.com/putaindecode","followers_url":"https://api.github.com/users/putaindecode/followers","following_url":"https://api.github.com/users/putaindecode/following{/other_user}","gists_url":"https://api.github.com/users/putaindecode/gists{/gist_id}","starred_url":"https://api.github.com/users/putaindecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/putaindecode/subscriptions","organizations_url":"https://api.github.com/users/putaindecode/orgs","repos_url":"https://api.github.com/users/putaindecode/repos","events_url":"https://api.github.com/users/putaindecode/events{/privacy}","received_events_url":"https://api.github.com/users/putaindecode/received_events","type":"Organization","site_admin":false},"repo":{"id":10319056,"name":"putaindecode.io","full_name":"putaindecode/putaindecode.io","owner":{"login":"putaindecode","id":4541781,"avatar_url":"https://avatars.githubusercontent.com/u/4541781?v=3","gravatar_id":"","url":"https://api.github.com/users/putaindecode","html_url":"https://github.com/putaindecode","followers_url":"https://api.github.com/users/putaindecode/followers","following_url":"https://api.github.com/users/putaindecode/following{/other_user}","gists_url":"https://api.github.com/users/putaindecode/gists{/gist_id}","starred_url":"https://api.github.com/users/putaindecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/putaindecode/subscriptions","organizations_url":"https://api.github.com/users/putaindecode/orgs","repos_url":"https://api.github.com/users/putaindecode/repos","events_url":"https://api.github.com/users/putaindecode/events{/privacy}","received_events_url":"https://api.github.com/users/putaindecode/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/putaindecode/putaindecode.io","description":"Putain de code ! is a place where you can read (and write) about best coding practices.  High quality content, reviewed by the community.","fork":false,"url":"https://api.github.com/repos/putaindecode/putaindecode.io","forks_url":"https://api.github.com/repos/putaindecode/putaindecode.io/forks","keys_url":"https://api.github.com/repos/putaindecode/putaindecode.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/putaindecode/putaindecode.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/putaindecode/putaindecode.io/teams","hooks_url":"https://api.github.com/repos/putaindecode/putaindecode.io/hooks","issue_events_url":"https://api.github.com/repos/putaindecode/putaindecode.io/issues/events{/number}","events_url":"https://api.github.com/repos/putaindecode/putaindecode.io/events","assignees_url":"https://api.github.com/repos/putaindecode/putaindecode.io/assignees{/user}","branches_url":"https://api.github.com/repos/putaindecode/putaindecode.io/branches{/branch}","tags_url":"https://api.github.com/repos/putaindecode/putaindecode.io/tags","blobs_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/putaindecode/putaindecode.io/statuses/{sha}","languages_url":"https://api.github.com/repos/putaindecode/putaindecode.io/languages","stargazers_url":"https://api.github.com/repos/putaindecode/putaindecode.io/stargazers","contributors_url":"https://api.github.com/repos/putaindecode/putaindecode.io/contributors","subscribers_url":"https://api.github.com/repos/putaindecode/putaindecode.io/subscribers","subscription_url":"https://api.github.com/repos/putaindecode/putaindecode.io/subscription","commits_url":"https://api.github.com/repos/putaindecode/putaindecode.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/putaindecode/putaindecode.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/putaindecode/putaindecode.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/putaindecode/putaindecode.io/contents/{+path}","compare_url":"https://api.github.com/repos/putaindecode/putaindecode.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/putaindecode/putaindecode.io/merges","archive_url":"https://api.github.com/repos/putaindecode/putaindecode.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/putaindecode/putaindecode.io/downloads","issues_url":"https://api.github.com/repos/putaindecode/putaindecode.io/issues{/number}","pulls_url":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls{/number}","milestones_url":"https://api.github.com/repos/putaindecode/putaindecode.io/milestones{/number}","notifications_url":"https://api.github.com/repos/putaindecode/putaindecode.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/putaindecode/putaindecode.io/labels{/name}","releases_url":"https://api.github.com/repos/putaindecode/putaindecode.io/releases{/id}","created_at":"2013-05-27T17:08:41Z","updated_at":"2015-12-03T09:38:10Z","pushed_at":"2015-12-03T10:51:25Z","git_url":"git://github.com/putaindecode/putaindecode.io.git","ssh_url":"git@github.com:putaindecode/putaindecode.io.git","clone_url":"https://github.com/putaindecode/putaindecode.io.git","svn_url":"https://github.com/putaindecode/putaindecode.io","homepage":"http://putaindecode.io/","size":66838,"stargazers_count":92,"watchers_count":92,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":61,"mirror_url":null,"open_issues_count":53,"forks":61,"open_issues":53,"watchers":92,"default_branch":"master"}},"base":{"label":"putaindecode:master","ref":"master","sha":"901cf84d67374f1cac35a760c995aef670da3478","user":{"login":"putaindecode","id":4541781,"avatar_url":"https://avatars.githubusercontent.com/u/4541781?v=3","gravatar_id":"","url":"https://api.github.com/users/putaindecode","html_url":"https://github.com/putaindecode","followers_url":"https://api.github.com/users/putaindecode/followers","following_url":"https://api.github.com/users/putaindecode/following{/other_user}","gists_url":"https://api.github.com/users/putaindecode/gists{/gist_id}","starred_url":"https://api.github.com/users/putaindecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/putaindecode/subscriptions","organizations_url":"https://api.github.com/users/putaindecode/orgs","repos_url":"https://api.github.com/users/putaindecode/repos","events_url":"https://api.github.com/users/putaindecode/events{/privacy}","received_events_url":"https://api.github.com/users/putaindecode/received_events","type":"Organization","site_admin":false},"repo":{"id":10319056,"name":"putaindecode.io","full_name":"putaindecode/putaindecode.io","owner":{"login":"putaindecode","id":4541781,"avatar_url":"https://avatars.githubusercontent.com/u/4541781?v=3","gravatar_id":"","url":"https://api.github.com/users/putaindecode","html_url":"https://github.com/putaindecode","followers_url":"https://api.github.com/users/putaindecode/followers","following_url":"https://api.github.com/users/putaindecode/following{/other_user}","gists_url":"https://api.github.com/users/putaindecode/gists{/gist_id}","starred_url":"https://api.github.com/users/putaindecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/putaindecode/subscriptions","organizations_url":"https://api.github.com/users/putaindecode/orgs","repos_url":"https://api.github.com/users/putaindecode/repos","events_url":"https://api.github.com/users/putaindecode/events{/privacy}","received_events_url":"https://api.github.com/users/putaindecode/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/putaindecode/putaindecode.io","description":"Putain de code ! is a place where you can read (and write) about best coding practices.  High quality content, reviewed by the community.","fork":false,"url":"https://api.github.com/repos/putaindecode/putaindecode.io","forks_url":"https://api.github.com/repos/putaindecode/putaindecode.io/forks","keys_url":"https://api.github.com/repos/putaindecode/putaindecode.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/putaindecode/putaindecode.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/putaindecode/putaindecode.io/teams","hooks_url":"https://api.github.com/repos/putaindecode/putaindecode.io/hooks","issue_events_url":"https://api.github.com/repos/putaindecode/putaindecode.io/issues/events{/number}","events_url":"https://api.github.com/repos/putaindecode/putaindecode.io/events","assignees_url":"https://api.github.com/repos/putaindecode/putaindecode.io/assignees{/user}","branches_url":"https://api.github.com/repos/putaindecode/putaindecode.io/branches{/branch}","tags_url":"https://api.github.com/repos/putaindecode/putaindecode.io/tags","blobs_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/putaindecode/putaindecode.io/statuses/{sha}","languages_url":"https://api.github.com/repos/putaindecode/putaindecode.io/languages","stargazers_url":"https://api.github.com/repos/putaindecode/putaindecode.io/stargazers","contributors_url":"https://api.github.com/repos/putaindecode/putaindecode.io/contributors","subscribers_url":"https://api.github.com/repos/putaindecode/putaindecode.io/subscribers","subscription_url":"https://api.github.com/repos/putaindecode/putaindecode.io/subscription","commits_url":"https://api.github.com/repos/putaindecode/putaindecode.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/putaindecode/putaindecode.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/putaindecode/putaindecode.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/putaindecode/putaindecode.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/putaindecode/putaindecode.io/contents/{+path}","compare_url":"https://api.github.com/repos/putaindecode/putaindecode.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/putaindecode/putaindecode.io/merges","archive_url":"https://api.github.com/repos/putaindecode/putaindecode.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/putaindecode/putaindecode.io/downloads","issues_url":"https://api.github.com/repos/putaindecode/putaindecode.io/issues{/number}","pulls_url":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls{/number}","milestones_url":"https://api.github.com/repos/putaindecode/putaindecode.io/milestones{/number}","notifications_url":"https://api.github.com/repos/putaindecode/putaindecode.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/putaindecode/putaindecode.io/labels{/name}","releases_url":"https://api.github.com/repos/putaindecode/putaindecode.io/releases{/id}","created_at":"2013-05-27T17:08:41Z","updated_at":"2015-12-03T09:38:10Z","pushed_at":"2015-12-03T10:51:25Z","git_url":"git://github.com/putaindecode/putaindecode.io.git","ssh_url":"git@github.com:putaindecode/putaindecode.io.git","clone_url":"https://github.com/putaindecode/putaindecode.io.git","svn_url":"https://github.com/putaindecode/putaindecode.io","homepage":"http://putaindecode.io/","size":66838,"stargazers_count":92,"watchers_count":92,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":61,"mirror_url":null,"open_issues_count":53,"forks":61,"open_issues":53,"watchers":92,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/564"},"html":{"href":"https://github.com/putaindecode/putaindecode.io/pull/564"},"issue":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/issues/564"},"comments":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/issues/564/comments"},"review_comments":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/564/comments"},"review_comment":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/pulls/564/commits"},"statuses":{"href":"https://api.github.com/repos/putaindecode/putaindecode.io/statuses/f77daeb4fa2da875436993c4b6f4d4dd412212be"}}}}