{"action":"created","issue":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10118","repository_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp","labels_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10118/labels{/name}","comments_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10118/comments","events_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10118/events","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/10118","id":169770509,"number":10118,"title":"Inconsistent results for 'smallestCommons([23, 18])'","user":{"login":"thoragio","id":9831905,"avatar_url":"https://avatars.githubusercontent.com/u/9831905?v=3","gravatar_id":"","url":"https://api.github.com/users/thoragio","html_url":"https://github.com/thoragio","followers_url":"https://api.github.com/users/thoragio/followers","following_url":"https://api.github.com/users/thoragio/following{/other_user}","gists_url":"https://api.github.com/users/thoragio/gists{/gist_id}","starred_url":"https://api.github.com/users/thoragio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoragio/subscriptions","organizations_url":"https://api.github.com/users/thoragio/orgs","repos_url":"https://api.github.com/users/thoragio/repos","events_url":"https://api.github.com/users/thoragio/events{/privacy}","received_events_url":"https://api.github.com/users/thoragio/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/labels/blocked","name":"blocked","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-06T22:55:09Z","updated_at":"2016-08-09T00:37:15Z","closed_at":null,"body":"Challenge [Smallest Common Multiple](https://www.freecodecamp.com/challenges/smallest-common-multiple#?solution=%22use%20strict%22%0A%0Aconst%20smallestCommons%20%3D%20(arr)%20%3D%3E%20%7B%0A%0A%20%20let%20range%20%3D%20%5B%5D%0A%20%20let%20rangeSize%20%3D%20arr%5B1%5D%20%3E%20arr%5B0%5D%20%3F%20arr%5B1%5D%20-%20arr%5B0%5D%20%2B%201%20%3A%20arr%5B0%5D%20-%20arr%5B1%5D%20%2B%201%0A%20%20let%20rangeStart%20%3D%20arr%5B1%5D%20%3E%20arr%5B0%5D%20%3F%20arr%5B0%5D%20%3A%20arr%5B1%5D%0A%20%20for%20(let%20i%20%3D%200%3B%20i%20%3C%20rangeSize%3B%20i%2B%2B)%20%7B%0A%20%20%20%20range.push(rangeStart)%0A%20%20%20%20rangeStart%2B%2B%0A%20%20%7D%0A%20%20console.log(range)%0A%0A%20%20let%20checkSmallest%20%3D%20range%5Brange.length%20-%201%5D%0A%20%20console.log(checkSmallest)%0A%0A%20%20for%20(let%20j%20%3D%200%3B%20j%20%3C%20range.length%3B%20j%2B%2B)%20%7B%0A%20%20%20%20if%20(checkSmallest%20%25%20range%5Bj%5D%20%3D%3D%200)%20%7B%0A%20%20%20%20%7D%0A%20%20%20%20else%20%7B%0A%20%20%20%20%20%20j%20%3D%20-1%0A%20%20%20%20%20%20checkSmallest%2B%2B%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20console.log(checkSmallest)%0A%20%20return%20checkSmallest%0A%7D%0A%0AsmallestCommons(%5B1%2C5%5D)%3B%0A) has an issue.\r\nUser Agent is: <code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36</code>.\r\nPlease describe how to reproduce this issue, and include links to screenshots if possible.\r\n\r\nI've tested my code using both Node 6.1.0 on my local machine and in CodePen and it returns the correct results (check the browser console log):\r\nhttps://codepen.io/thoragio/pen/LkgKjA\r\n\r\nHowever, when I run this same code against the test in the challenge, the last test ( smallestCommons([23, 18]) ) fails. When I look at the browser console log, I see that my return value is always a different number somewhere in the 4 million range (e.g., 4841427, 4701970, 4950014), but the correct answer is supposed to be 6056820.\r\n\r\nMy code:\r\n```javascript\r\n\"use strict\"\r\n\r\nconst smallestCommons = (arr) => {\r\n\r\n  let range = []\r\n  let rangeSize = arr[1] > arr[0] ? arr[1] - arr[0] + 1 : arr[0] - arr[1] + 1\r\n  let rangeStart = arr[1] > arr[0] ? arr[0] : arr[1]\r\n  for (let i = 0; i < rangeSize; i++) {\r\n    range.push(rangeStart)\r\n    rangeStart++\r\n  }\r\n  console.log(range)\r\n\r\n  let checkSmallest = range[range.length - 1]\r\n  console.log(checkSmallest)\r\n\r\n  for (let j = 0; j < range.length; j++) {\r\n    if (checkSmallest % range[j] == 0) {\r\n    }\r\n    else {\r\n      j = -1\r\n      checkSmallest++\r\n    }\r\n  }\r\n  console.log(checkSmallest)\r\n  return checkSmallest\r\n}\r\n\r\nsmallestCommons([1,5]);\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/comments/238419923","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/10118#issuecomment-238419923","issue_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/10118","id":238419923,"user":{"login":"thoragio","id":9831905,"avatar_url":"https://avatars.githubusercontent.com/u/9831905?v=3","gravatar_id":"","url":"https://api.github.com/users/thoragio","html_url":"https://github.com/thoragio","followers_url":"https://api.github.com/users/thoragio/followers","following_url":"https://api.github.com/users/thoragio/following{/other_user}","gists_url":"https://api.github.com/users/thoragio/gists{/gist_id}","starred_url":"https://api.github.com/users/thoragio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoragio/subscriptions","organizations_url":"https://api.github.com/users/thoragio/orgs","repos_url":"https://api.github.com/users/thoragio/repos","events_url":"https://api.github.com/users/thoragio/events{/privacy}","received_events_url":"https://api.github.com/users/thoragio/received_events","type":"User","site_admin":false},"created_at":"2016-08-09T00:37:15Z","updated_at":"2016-08-09T00:37:15Z","body":"@erictleung @alistermada @BKinahan Thanks for looking into this.\r\n\r\nI appreciate that my code is pretty inefficient, but in my early stages of learning JS I am more focused on \"getting it to work\" than \"getting it to work optimally\". Given that, I am not sure if what I have observed is really worthy of being deemed a bug to fix in the FCC platform, but it was confusing for me because my code worked fine running with Node locally and on another hosted platform (CodePen).\r\n\r\nI will leave it up to you guys whether you want to keep this issue open and address it somehow (perhaps just a mention somewhere in the challenge description that inefficient code might fail some of the tests?) or just close it. Thanks for your time considering it in any case.\r\n\r\nAnd thank you for the great work on FCC. I really appreciate this great learning resource."}}
{"actor":{"display_login":"thoragio"}}