{"action":"created","issue":{"url":"https://api.github.com/repos/prettydiff/Array.prototype.last/issues/1","labels_url":"https://api.github.com/repos/prettydiff/Array.prototype.last/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/prettydiff/Array.prototype.last/issues/1/comments","events_url":"https://api.github.com/repos/prettydiff/Array.prototype.last/issues/1/events","html_url":"https://github.com/prettydiff/Array.prototype.last/issues/1","id":77167757,"number":1,"title":"Why make it a function","user":{"login":"eorroe","id":6982605,"avatar_url":"https://avatars.githubusercontent.com/u/6982605?v=3","gravatar_id":"","url":"https://api.github.com/users/eorroe","html_url":"https://github.com/eorroe","followers_url":"https://api.github.com/users/eorroe/followers","following_url":"https://api.github.com/users/eorroe/following{/other_user}","gists_url":"https://api.github.com/users/eorroe/gists{/gist_id}","starred_url":"https://api.github.com/users/eorroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eorroe/subscriptions","organizations_url":"https://api.github.com/users/eorroe/orgs","repos_url":"https://api.github.com/users/eorroe/repos","events_url":"https://api.github.com/users/eorroe/events{/privacy}","received_events_url":"https://api.github.com/users/eorroe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-17T00:27:19Z","updated_at":"2015-05-17T01:03:43Z","closed_at":null,"body":"Why not do this instead:\r\n\r\n```\r\nObject.defineProperty(Array.prototype, 'last', {\r\n  get() {\r\n    return this[this.length - 1];\r\n  }\r\n});\r\n\r\nvar arr = [1,2,3];\r\n\r\nconsole.log(arr.last); // 3\r\n```"},"comment":{"url":"https://api.github.com/repos/prettydiff/Array.prototype.last/issues/comments/102717639","html_url":"https://github.com/prettydiff/Array.prototype.last/issues/1#issuecomment-102717639","issue_url":"https://api.github.com/repos/prettydiff/Array.prototype.last/issues/1","id":102717639,"user":{"login":"prettydiff","id":524902,"avatar_url":"https://avatars.githubusercontent.com/u/524902?v=3","gravatar_id":"","url":"https://api.github.com/users/prettydiff","html_url":"https://github.com/prettydiff","followers_url":"https://api.github.com/users/prettydiff/followers","following_url":"https://api.github.com/users/prettydiff/following{/other_user}","gists_url":"https://api.github.com/users/prettydiff/gists{/gist_id}","starred_url":"https://api.github.com/users/prettydiff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prettydiff/subscriptions","organizations_url":"https://api.github.com/users/prettydiff/orgs","repos_url":"https://api.github.com/users/prettydiff/repos","events_url":"https://api.github.com/users/prettydiff/events{/privacy}","received_events_url":"https://api.github.com/users/prettydiff/received_events","type":"User","site_admin":false},"created_at":"2015-05-17T01:03:43Z","updated_at":"2015-05-17T01:03:43Z","body":"A `first` method is not so needed in my opinion.  For arrays that are not sparse the first index will always be index 0.  This is always known, which is the primary difference between a last method because the length of the array is not always known. I am not concerned with sparse arrays, because they do not compile efficient in JIT engines."}}