{"action":"closed","issue":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/5936","labels_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/5936/labels{/name}","comments_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/5936/comments","events_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/5936/events","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/5936","id":125308476,"number":5936,"title":"Suggestion for JavaScript if/else waypoints and checkpoints","user":{"login":"quatridunull","id":9910483,"avatar_url":"https://avatars.githubusercontent.com/u/9910483?v=3","gravatar_id":"","url":"https://api.github.com/users/quatridunull","html_url":"https://github.com/quatridunull","followers_url":"https://api.github.com/users/quatridunull/followers","following_url":"https://api.github.com/users/quatridunull/following{/other_user}","gists_url":"https://api.github.com/users/quatridunull/gists{/gist_id}","starred_url":"https://api.github.com/users/quatridunull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quatridunull/subscriptions","organizations_url":"https://api.github.com/users/quatridunull/orgs","repos_url":"https://api.github.com/users/quatridunull/repos","events_url":"https://api.github.com/users/quatridunull/events{/privacy}","received_events_url":"https://api.github.com/users/quatridunull/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/labels/curriculum%20request","name":"curriculum request","color":"d4c5f9"},{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-07T02:30:27Z","updated_at":"2016-01-10T20:46:44Z","closed_at":"2016-01-10T20:46:44Z","body":"All the new exercises are great, and help clarify a lot of concepts, but I think there is one thing missing from the way if/else statements are taught. One of the challenges that people face when understanding control statements is how to properly order each case.\r\n\r\nFor instance, if we want to output \"less than one\" when the input is less than one, and \"less than two\" when the input is less than two but greater than one, and \"greater than or equal to two\" otherwise, this is correct:\r\n<pre><code>\r\nfunction foo(x) {\r\n  if ( x < 1 ) {\r\n    return \"less than one\";\r\n  }\r\n  else if ( x < 2 ) {\r\n    return \"less than two\";\r\n  }\r\n  else {\r\n    return \"greater than or equal to two\";\r\n  }\r\n}\r\n</code></pre>\r\n\r\nWhile this is wrong because the function will return \"less than two\" when what we really want is \"less than one\":\r\n<pre><code>\r\nfunction bar(x) {\r\n  if ( x < 2 ) {\r\n    return \"less than two\";\r\n  }\r\n  else if ( x < 1 ) {\r\n    return \"less than one\";\r\n  }\r\n  else {\r\n    return \"greater than or equal to two\";\r\n  }\r\n}\r\n</code></pre>\r\n\r\nCurrently, FCC's JavaScript section does not teach this while teaching control statements because it always presents the statements in the correct order. That is, FCC's directions would say:\r\n>Output \"less than one\" when the input is less than one, and \"less than two\" when the input is less than two but greater than one, and \"greater than or equal to two\" otherwise.\r\n\r\njust as I have said earlier in this issue, which is in the same order that the code should be written. \r\nHowever, if instead the order of directions were swapped like so:\r\n\r\n>Output \"less than two\" when the input is less than two but greater than one, \"less than one\" when the input is less than one, and \"greater than or equal to two\" otherwise. Note that the order of each conditional statement can affect your code's output!\r\n\r\nthen this would give campers an opportunity to learn for themselves how order matters, and which order they need to put the comparisons.\r\n\r\nSo I think if there was a waypoint similar to the example I just gave, and another one using the less than comparator, and the Golf Code checkpoint was modified to switch around the ordering, then the lessons on if/else statements could teach this important concept."}}