diff --git a/exercises/async_loops/exercise.js b/exercises/async_loops/exercise.js index b084927..ed963c3 100644 --- a/exercises/async_loops/exercise.js +++ b/exercises/async_loops/exercise.js @@ -41,6 +41,15 @@ module.exports = runner.custom(function(f) { clearTimeout(tooLong) console.log(submittedUsers) + var functionAsAString = fx.toString(); + if ( + functionAsAString.indexOf('for') !== -1 || + functionAsAString.indexOf('while') !== -1 + ) { + self.emit('fail', self.__('used_loops')); + return callback(null, false); + } + if (!deepEqual(submittedUsers, users)) { self.emit('fail', self.__('bad_result', inspect(users), inspect(submittedUsers))) return callback(null, false) diff --git a/i18n/en.json b/i18n/en.json index 6e1f8ee..c028eea 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -40,7 +40,8 @@ "Async Loops": { "all_loaded": "All %d users loaded!", "bad_result": "expected: \n%s\n but got:\n%s", - "took_too_long": "Took too long!" + "took_too_long": "Took too long!", + "used_loops": "Used a loop!", }, "Currying": { "five_words": "This,problem,has,been,solved"