{"action":"created","issue":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/7072","repository_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp","labels_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/7072/labels{/name}","comments_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/7072/comments","events_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/7072/events","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/7072","id":134087212,"number":7072,"title":"Receiving \"SyntaxError: Illegal break statement\", yet no break statement being used...","user":{"login":"Ramon-Carroll","id":15251837,"avatar_url":"https://avatars.githubusercontent.com/u/15251837?v=3","gravatar_id":"","url":"https://api.github.com/users/Ramon-Carroll","html_url":"https://github.com/Ramon-Carroll","followers_url":"https://api.github.com/users/Ramon-Carroll/followers","following_url":"https://api.github.com/users/Ramon-Carroll/following{/other_user}","gists_url":"https://api.github.com/users/Ramon-Carroll/gists{/gist_id}","starred_url":"https://api.github.com/users/Ramon-Carroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ramon-Carroll/subscriptions","organizations_url":"https://api.github.com/users/Ramon-Carroll/orgs","repos_url":"https://api.github.com/users/Ramon-Carroll/repos","events_url":"https://api.github.com/users/Ramon-Carroll/events{/privacy}","received_events_url":"https://api.github.com/users/Ramon-Carroll/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/labels/confirmed","name":"confirmed","color":"ededed"},{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-02-16T20:21:25Z","updated_at":"2016-10-13T20:32:11Z","closed_at":null,"body":"Challenge [Smallest Common Multiple](http://www.freecodecamp.com/challenges/smallest-common-multiple#?solution=%2F*%20This%20was%20a%20tough%20one%20for%20me.%0ALet's%20use%20the%20Euclidean%20Algorithm%20to%20first%20get%20the%20GCD%20and%20%0Athen%20use%20that%20to%20calculate%20the%20LCM%0AThis%20below%20function%20for%20obtaining%20the%20gcd%20was%20posted%20on%20StackOverflow%20by%20%22alex%22%20at%20%0Ahttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F17445231%2Fjs-how-to-find-the-greatest-common-divisor%2F17445304%2317445304.%20%0A*%2F%0Afunction%20gcd(a%2C%20b)%20%7B%0A%20%20%20%20if%20(!b)%20%7B%0A%20%20%20%20%20%20%20%20return%20a%3B%0A%20%20%20%20%7D%20%20%20%20%0A%20%20%20%20return%20gcd(b%2C%20a%20%25%20b)%3B%0A%7D%0A%0Afunction%20smallestCommons(arr)%20%7B%0A%20%20%20%20var%20newArr%20%3D%20%5B%5D%3B%20%2F*Will%20hold%20the%20range%20of%20numbers%20from%20arr%5B0%5D%20to%20arr%5B1%5D.*%2F%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20arr.sort(function(val1%2C%20val2)%20%7B%20%2F*Order%20the%20array%20from%20least%20to%20greatest.*%2F%0A%20%20%20%20%20%20%20%20return%20val1%20-%20val2%3B%0A%20%20%20%20%7D)%3B%0A%20%20%20%20%0A%20%20%20%20for%20(var%20i%20%3D%20arr%5B0%5D%3B%20i%20%3C%3D%20arr%5B1%5D%3B%20i%2B%2B)%20%7B%20%2F*Create%20the%20full%20range%20of%20values%20under%20consideration.*%2F%0A%20%20%20%20%20%20%20%20newArr.push(i)%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20%2F*Formula%20to%20use%20is%20LCM(a%2Cb)%20%3D%20a%20*%20b%20%2F%20GCD(a%2C%20b).%20%0A%20%20%20%20Reduce%20array%20by%20recursively%20applying%20the%20formula%20to%20%0A%20%20%20%20the%20first%20two%20values%20until%20there%20is%20only%20one%20value%20left.*%2F%0A%20%20%20%20return%20newArr.reduce(function(a%2C%20b)%20%7B%20%0A%20%20%20%20%20%20%20%20return%20(a%20*%20b)%20%2F%20(gcd(a%2C%20b))%3B%0A%20%20%20%20%7D)%3B%0A%7D%0A%0AsmallestCommons(%5B1%2C%205%5D)%3B%0A) has an issue.\r\nUser Agent is: <code>Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36</code>.\r\nI keep receiving this error: \"SyntaxError: Illegal break statement.\" That doesn't make any sense, because my code isn't using a break statement anywhere, even in my for loop. The code works and passes all test cases when I log the output in the console. Am I missing something?\r\n\r\nMy code:\r\n```javascript\r\n/* This was a tough one for me.\r\nLet's use the Euclidean Algorithm to first get the GCD and \r\nthen use that to calculate the LCM\r\nThis below function for obtaining the gcd was posted on StackOverflow by \"alex\" at \r\nhttps://stackoverflow.com/questions/17445231/js-how-to-find-the-greatest-common-divisor/. \r\n*/\r\nfunction gcd(a, b) {\r\n    if (!b) {\r\n        return a;\r\n    }    \r\n    return gcd(b, a % b);\r\n}\r\n\r\nfunction smallestCommons(arr) {\r\n    var newArr = []; /*Will hold the range of numbers from arr[0] to arr[1].*/\r\n        \r\n    arr.sort(function(val1, val2) { /*Order the array from least to greatest.*/\r\n        return val1 - val2;\r\n    });\r\n    \r\n    for (var i = arr[0]; i <= arr[1]; i++) { /*Create the full range of values under consideration.*/\r\n        newArr.push(i);\r\n    }\r\n    \r\n    /*Formula to use is LCM(a,b) = a * b / GCD(a, b). \r\n    Reduce array by recursively applying the formula to \r\n    the first two values until there is only one value left.*/\r\n    return newArr.reduce(function(a, b) { \r\n        return (a * b) / (gcd(a, b));\r\n    });\r\n}\r\n\r\nsmallestCommons([1, 5]);\r\n\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/comments/253630069","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/7072#issuecomment-253630069","issue_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/7072","id":253630069,"user":{"login":"ltegman","id":1381313,"avatar_url":"https://avatars.githubusercontent.com/u/1381313?v=3","gravatar_id":"","url":"https://api.github.com/users/ltegman","html_url":"https://github.com/ltegman","followers_url":"https://api.github.com/users/ltegman/followers","following_url":"https://api.github.com/users/ltegman/following{/other_user}","gists_url":"https://api.github.com/users/ltegman/gists{/gist_id}","starred_url":"https://api.github.com/users/ltegman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ltegman/subscriptions","organizations_url":"https://api.github.com/users/ltegman/orgs","repos_url":"https://api.github.com/users/ltegman/repos","events_url":"https://api.github.com/users/ltegman/events{/privacy}","received_events_url":"https://api.github.com/users/ltegman/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T20:32:10Z","updated_at":"2016-10-13T20:32:10Z","body":"Assuming our power doesn't go out with the incoming NW storm I can take a look at this in the next couple of days. Anyone else is free to take it though since I may or may not lose power."}}
{"actor":{"display_login":"ltegman"}}