timoxley / functional-javascript-workshop

A functional javascript workshop. No libraries required (i.e. no underscore), just ES5.
2.06k stars 441 forks source link

'Do not use any for/while loops..' does not detect for loops and allows user to pass #174

Closed libersolis-dev closed 7 years ago

libersolis-dev commented 7 years ago

Let me just say thank you for all of the work put into this. It's great to have practice problems that give immediate feedback, particulary on such an interesting an import subject. I have detected the following issue. 'Do not use any for/while loops..' does not detect for loops and allows user to pass

It seems to give credit as long as map is used correctly but fails to detect for loops. Teaching this in a classroom setting was confusing to some students I was with and contradicted a mini lecture I was giving on how map is an important part of React because of it not mutating state like for the common loop then push to array patterns that are commonly used.

function doubleAll(numbers) {
      var result = []
      for (var i = 0; i < numbers.length; i++) {
        result.push(numbers[i] * 2)
      }
      return result
    }

    module.exports = doubleAll

screen shot 2017-02-21 at 9 32 42 am