{"action":"created","comment":{"url":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/comments/172051250","pull_request_review_id":101007883,"id":172051250,"diff_hunk":"@@ -1,59 +1,101 @@\n+\n+\n export const getNthElement = (index, array) => {\n-  // your code here\n+  if (index + 1 > array.length){\n+    return array[index - array.length];\n+  }\n+  return array[index];\n };\n \n export const arrayToCSVString = (array) => {\n-  // your code here\n+  return array.toString('');\n };\n \n export const csvStringToArray = (string) => {\n-  // your code here\n+  string = string.replace(/,/g, '');\n+  \n+  return string.split('');\n };\n \n export const addToArray = (array, element) => {\n-  // your code here\n+  element.push(array);\n };\n \n-export const addToArray2 = (array, element) => {\n-  // your code here\n+export const addToArray2 = (element, array) => {\n+  let arrayClone = array.slice();\n+  arrayClone.push(element);\n+  return arrayClone;\n };\n \n export const removeNthElement = (index, array) => {\n-  // your code here\n+   \n+  return array.splice(index, 1);\n };\n \n export const numbersToStrings = (numbers) => {\n-  // your code here\n+  return numbers.toString().split(',');\n };\n \n export const uppercaseWordsInArray = (strings) => {\n-  // your code here\n+  let stringsUpper = String(strings).toUpperCase().split(\",\");\n+  return stringsUpper;\n };\n \n export const reverseWordsInArray = (strings) => {\n-  // your code here\n-};\n+  for(let i =0; i<strings.length; i++){\n+    strings[i] = strings[i].split('').reverse().join('');\n+  }\n+  return strings;\n+}\n+\n \n export const onlyEven = (numbers) => {\n-  // your code here\n+  return numbers.filter(number => number % 2 ===0);\n };\n \n export const removeNthElement2 = (index, array) => {\n-  // your code here\n+  return array.slice(0, index).concat(array.slice(index+1));\n+  \n };\n \n export const elementsStartingWithAVowel = (strings) => {\n-  // your code here\n+  \n+  const vowels = ['a','e','i','o','u'];\n+  let newArray = [];\n+  for (let i=0; i<strings.length; i++){\n+    for (let j=0; j<vowels.length; j++){\n+      if (strings[i].charAt(0).toLowerCase() == vowels[j]){\n+        newArray.push(strings[i]);\n+      }\n+    }\n+  }\n+  return newArray;\n };\n \n export const removeSpaces = (string) => {\n-  // your code here\n+  let string2 = string.replace(/ /g, '');\n+  return string2;\n };\n \n export const sumNumbers = (numbers) => {\n-  // your code here\n+  let total = 0;\n+  for (let number = 0; number <numbers.length; number ++){\n+    total += numbers[number];\n+  }\n+  return total;\n };\n \n export const sortByLastLetter = (strings) => {\n-  // your code here\n+    strings.sort(function (a, b){\n+    let lastA = a.charAt(a.length - 1); //last letter of word a\n+    let lastB = b.charAt(b.length - 1); //last letter of word b\n+    if (lastA > lastB){  \n+      return 1;    // return 1 means put b before a\n+    }else if (lastA < lastB){","path":"src/arrays.js","position":111,"original_position":111,"commit_id":"9923d8bd9e024e34b0b906d4b4732224dcad47db","original_commit_id":"9923d8bd9e024e34b0b906d4b4732224dcad47db","user":{"login":"joestephens","id":13698377,"avatar_url":"https://avatars2.githubusercontent.com/u/13698377?v=4","gravatar_id":"","url":"https://api.github.com/users/joestephens","html_url":"https://github.com/joestephens","followers_url":"https://api.github.com/users/joestephens/followers","following_url":"https://api.github.com/users/joestephens/following{/other_user}","gists_url":"https://api.github.com/users/joestephens/gists{/gist_id}","starred_url":"https://api.github.com/users/joestephens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joestephens/subscriptions","organizations_url":"https://api.github.com/users/joestephens/orgs","repos_url":"https://api.github.com/users/joestephens/repos","events_url":"https://api.github.com/users/joestephens/events{/privacy}","received_events_url":"https://api.github.com/users/joestephens/received_events","type":"User","site_admin":false},"body":"Spacing: `} else if (lastA < lastB) {`","created_at":"2018-03-04T14:49:35Z","updated_at":"2018-03-04T14:56:42Z","html_url":"https://github.com/MCRcodes/javascript-basics/pull/3#discussion_r172051250","pull_request_url":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/3","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/comments/172051250"},"html":{"href":"https://github.com/MCRcodes/javascript-basics/pull/3#discussion_r172051250"},"pull_request":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/3","id":170417088,"html_url":"https://github.com/MCRcodes/javascript-basics/pull/3","diff_url":"https://github.com/MCRcodes/javascript-basics/pull/3.diff","patch_url":"https://github.com/MCRcodes/javascript-basics/pull/3.patch","issue_url":"https://api.github.com/repos/MCRcodes/javascript-basics/issues/3","number":3,"state":"open","locked":false,"title":"Joe Allen javascript basics completed","user":{"login":"joeallen76","id":27720350,"avatar_url":"https://avatars1.githubusercontent.com/u/27720350?v=4","gravatar_id":"","url":"https://api.github.com/users/joeallen76","html_url":"https://github.com/joeallen76","followers_url":"https://api.github.com/users/joeallen76/followers","following_url":"https://api.github.com/users/joeallen76/following{/other_user}","gists_url":"https://api.github.com/users/joeallen76/gists{/gist_id}","starred_url":"https://api.github.com/users/joeallen76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeallen76/subscriptions","organizations_url":"https://api.github.com/users/joeallen76/orgs","repos_url":"https://api.github.com/users/joeallen76/repos","events_url":"https://api.github.com/users/joeallen76/events{/privacy}","received_events_url":"https://api.github.com/users/joeallen76/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-21T09:37:39Z","updated_at":"2018-03-04T14:56:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea9a9d964f39beb0afbb5df5d9180ac154bea08c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/3/commits","review_comments_url":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/3/comments","review_comment_url":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MCRcodes/javascript-basics/issues/3/comments","statuses_url":"https://api.github.com/repos/MCRcodes/javascript-basics/statuses/9923d8bd9e024e34b0b906d4b4732224dcad47db","head":{"label":"joeallen76:master","ref":"master","sha":"9923d8bd9e024e34b0b906d4b4732224dcad47db","user":{"login":"joeallen76","id":27720350,"avatar_url":"https://avatars1.githubusercontent.com/u/27720350?v=4","gravatar_id":"","url":"https://api.github.com/users/joeallen76","html_url":"https://github.com/joeallen76","followers_url":"https://api.github.com/users/joeallen76/followers","following_url":"https://api.github.com/users/joeallen76/following{/other_user}","gists_url":"https://api.github.com/users/joeallen76/gists{/gist_id}","starred_url":"https://api.github.com/users/joeallen76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeallen76/subscriptions","organizations_url":"https://api.github.com/users/joeallen76/orgs","repos_url":"https://api.github.com/users/joeallen76/repos","events_url":"https://api.github.com/users/joeallen76/events{/privacy}","received_events_url":"https://api.github.com/users/joeallen76/received_events","type":"User","site_admin":false},"repo":{"id":121297344,"name":"javascript-basics","full_name":"joeallen76/javascript-basics","owner":{"login":"joeallen76","id":27720350,"avatar_url":"https://avatars1.githubusercontent.com/u/27720350?v=4","gravatar_id":"","url":"https://api.github.com/users/joeallen76","html_url":"https://github.com/joeallen76","followers_url":"https://api.github.com/users/joeallen76/followers","following_url":"https://api.github.com/users/joeallen76/following{/other_user}","gists_url":"https://api.github.com/users/joeallen76/gists{/gist_id}","starred_url":"https://api.github.com/users/joeallen76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeallen76/subscriptions","organizations_url":"https://api.github.com/users/joeallen76/orgs","repos_url":"https://api.github.com/users/joeallen76/repos","events_url":"https://api.github.com/users/joeallen76/events{/privacy}","received_events_url":"https://api.github.com/users/joeallen76/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joeallen76/javascript-basics","description":"Exercises covering basic JavaScript concepts","fork":true,"url":"https://api.github.com/repos/joeallen76/javascript-basics","forks_url":"https://api.github.com/repos/joeallen76/javascript-basics/forks","keys_url":"https://api.github.com/repos/joeallen76/javascript-basics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joeallen76/javascript-basics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joeallen76/javascript-basics/teams","hooks_url":"https://api.github.com/repos/joeallen76/javascript-basics/hooks","issue_events_url":"https://api.github.com/repos/joeallen76/javascript-basics/issues/events{/number}","events_url":"https://api.github.com/repos/joeallen76/javascript-basics/events","assignees_url":"https://api.github.com/repos/joeallen76/javascript-basics/assignees{/user}","branches_url":"https://api.github.com/repos/joeallen76/javascript-basics/branches{/branch}","tags_url":"https://api.github.com/repos/joeallen76/javascript-basics/tags","blobs_url":"https://api.github.com/repos/joeallen76/javascript-basics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joeallen76/javascript-basics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joeallen76/javascript-basics/git/refs{/sha}","trees_url":"https://api.github.com/repos/joeallen76/javascript-basics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joeallen76/javascript-basics/statuses/{sha}","languages_url":"https://api.github.com/repos/joeallen76/javascript-basics/languages","stargazers_url":"https://api.github.com/repos/joeallen76/javascript-basics/stargazers","contributors_url":"https://api.github.com/repos/joeallen76/javascript-basics/contributors","subscribers_url":"https://api.github.com/repos/joeallen76/javascript-basics/subscribers","subscription_url":"https://api.github.com/repos/joeallen76/javascript-basics/subscription","commits_url":"https://api.github.com/repos/joeallen76/javascript-basics/commits{/sha}","git_commits_url":"https://api.github.com/repos/joeallen76/javascript-basics/git/commits{/sha}","comments_url":"https://api.github.com/repos/joeallen76/javascript-basics/comments{/number}","issue_comment_url":"https://api.github.com/repos/joeallen76/javascript-basics/issues/comments{/number}","contents_url":"https://api.github.com/repos/joeallen76/javascript-basics/contents/{+path}","compare_url":"https://api.github.com/repos/joeallen76/javascript-basics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joeallen76/javascript-basics/merges","archive_url":"https://api.github.com/repos/joeallen76/javascript-basics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joeallen76/javascript-basics/downloads","issues_url":"https://api.github.com/repos/joeallen76/javascript-basics/issues{/number}","pulls_url":"https://api.github.com/repos/joeallen76/javascript-basics/pulls{/number}","milestones_url":"https://api.github.com/repos/joeallen76/javascript-basics/milestones{/number}","notifications_url":"https://api.github.com/repos/joeallen76/javascript-basics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joeallen76/javascript-basics/labels{/name}","releases_url":"https://api.github.com/repos/joeallen76/javascript-basics/releases{/id}","deployments_url":"https://api.github.com/repos/joeallen76/javascript-basics/deployments","created_at":"2018-02-12T20:22:41Z","updated_at":"2018-02-12T20:22:42Z","pushed_at":"2018-02-21T09:36:23Z","git_url":"git://github.com/joeallen76/javascript-basics.git","ssh_url":"git@github.com:joeallen76/javascript-basics.git","clone_url":"https://github.com/joeallen76/javascript-basics.git","svn_url":"https://github.com/joeallen76/javascript-basics","homepage":null,"size":54,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MCRcodes:master","ref":"master","sha":"d5fbf72a358fd2ec49b636016247937b9c038120","user":{"login":"MCRcodes","id":29207840,"avatar_url":"https://avatars3.githubusercontent.com/u/29207840?v=4","gravatar_id":"","url":"https://api.github.com/users/MCRcodes","html_url":"https://github.com/MCRcodes","followers_url":"https://api.github.com/users/MCRcodes/followers","following_url":"https://api.github.com/users/MCRcodes/following{/other_user}","gists_url":"https://api.github.com/users/MCRcodes/gists{/gist_id}","starred_url":"https://api.github.com/users/MCRcodes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MCRcodes/subscriptions","organizations_url":"https://api.github.com/users/MCRcodes/orgs","repos_url":"https://api.github.com/users/MCRcodes/repos","events_url":"https://api.github.com/users/MCRcodes/events{/privacy}","received_events_url":"https://api.github.com/users/MCRcodes/received_events","type":"Organization","site_admin":false},"repo":{"id":120945443,"name":"javascript-basics","full_name":"MCRcodes/javascript-basics","owner":{"login":"MCRcodes","id":29207840,"avatar_url":"https://avatars3.githubusercontent.com/u/29207840?v=4","gravatar_id":"","url":"https://api.github.com/users/MCRcodes","html_url":"https://github.com/MCRcodes","followers_url":"https://api.github.com/users/MCRcodes/followers","following_url":"https://api.github.com/users/MCRcodes/following{/other_user}","gists_url":"https://api.github.com/users/MCRcodes/gists{/gist_id}","starred_url":"https://api.github.com/users/MCRcodes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MCRcodes/subscriptions","organizations_url":"https://api.github.com/users/MCRcodes/orgs","repos_url":"https://api.github.com/users/MCRcodes/repos","events_url":"https://api.github.com/users/MCRcodes/events{/privacy}","received_events_url":"https://api.github.com/users/MCRcodes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MCRcodes/javascript-basics","description":"Exercises covering basic JavaScript concepts","fork":false,"url":"https://api.github.com/repos/MCRcodes/javascript-basics","forks_url":"https://api.github.com/repos/MCRcodes/javascript-basics/forks","keys_url":"https://api.github.com/repos/MCRcodes/javascript-basics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MCRcodes/javascript-basics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MCRcodes/javascript-basics/teams","hooks_url":"https://api.github.com/repos/MCRcodes/javascript-basics/hooks","issue_events_url":"https://api.github.com/repos/MCRcodes/javascript-basics/issues/events{/number}","events_url":"https://api.github.com/repos/MCRcodes/javascript-basics/events","assignees_url":"https://api.github.com/repos/MCRcodes/javascript-basics/assignees{/user}","branches_url":"https://api.github.com/repos/MCRcodes/javascript-basics/branches{/branch}","tags_url":"https://api.github.com/repos/MCRcodes/javascript-basics/tags","blobs_url":"https://api.github.com/repos/MCRcodes/javascript-basics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MCRcodes/javascript-basics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MCRcodes/javascript-basics/git/refs{/sha}","trees_url":"https://api.github.com/repos/MCRcodes/javascript-basics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MCRcodes/javascript-basics/statuses/{sha}","languages_url":"https://api.github.com/repos/MCRcodes/javascript-basics/languages","stargazers_url":"https://api.github.com/repos/MCRcodes/javascript-basics/stargazers","contributors_url":"https://api.github.com/repos/MCRcodes/javascript-basics/contributors","subscribers_url":"https://api.github.com/repos/MCRcodes/javascript-basics/subscribers","subscription_url":"https://api.github.com/repos/MCRcodes/javascript-basics/subscription","commits_url":"https://api.github.com/repos/MCRcodes/javascript-basics/commits{/sha}","git_commits_url":"https://api.github.com/repos/MCRcodes/javascript-basics/git/commits{/sha}","comments_url":"https://api.github.com/repos/MCRcodes/javascript-basics/comments{/number}","issue_comment_url":"https://api.github.com/repos/MCRcodes/javascript-basics/issues/comments{/number}","contents_url":"https://api.github.com/repos/MCRcodes/javascript-basics/contents/{+path}","compare_url":"https://api.github.com/repos/MCRcodes/javascript-basics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MCRcodes/javascript-basics/merges","archive_url":"https://api.github.com/repos/MCRcodes/javascript-basics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MCRcodes/javascript-basics/downloads","issues_url":"https://api.github.com/repos/MCRcodes/javascript-basics/issues{/number}","pulls_url":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls{/number}","milestones_url":"https://api.github.com/repos/MCRcodes/javascript-basics/milestones{/number}","notifications_url":"https://api.github.com/repos/MCRcodes/javascript-basics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MCRcodes/javascript-basics/labels{/name}","releases_url":"https://api.github.com/repos/MCRcodes/javascript-basics/releases{/id}","deployments_url":"https://api.github.com/repos/MCRcodes/javascript-basics/deployments","created_at":"2018-02-09T19:15:53Z","updated_at":"2018-02-10T00:35:24Z","pushed_at":"2018-03-02T21:00:49Z","git_url":"git://github.com/MCRcodes/javascript-basics.git","ssh_url":"git@github.com:MCRcodes/javascript-basics.git","clone_url":"https://github.com/MCRcodes/javascript-basics.git","svn_url":"https://github.com/MCRcodes/javascript-basics","homepage":null,"size":53,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":17,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/3"},"html":{"href":"https://github.com/MCRcodes/javascript-basics/pull/3"},"issue":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/issues/3"},"comments":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/MCRcodes/javascript-basics/statuses/9923d8bd9e024e34b0b906d4b4732224dcad47db"}},"author_association":"NONE"}}
{"actor":{"display_login":"joestephens"}}