From 4145efc467e585de356a804f3343c3cf0ef416dd Mon Sep 17 00:00:00 2001 From: Aditya Date: Tue, 4 Dec 2018 17:20:19 +0530 Subject: [PATCH] [fix] Test for Pass Arguments to Avoid External Dependence in a Function (#34522) * feat: test works for => fns, added solution * fix: moved solution --- ...-avoid-external-dependence-in-a-function.english.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.english.md index f2fa09ce03..413853a3ae 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/pass-arguments-to-avoid-external-dependence-in-a-function.english.md @@ -28,7 +28,7 @@ tests: - text: Your function incrementer should not change the value of fixedValue. testString: assert(fixedValue === 4, 'Your function incrementer should not change the value of fixedValue.'); - text: Your incrementer function should take a parameter. - testString: assert(code.match(/function\s+?incrementer\s*?\(.+?\)/g), 'Your incrementer function should take a parameter.'); + testString: assert(incrementer.length === 1, 'Your incrementer function should take a parameter.'); - text: Your incrementer function should return a value that is one larger than the fixedValue value. testString: assert(newValue === 5, 'Your incrementer function should return a value that is one larger than the fixedValue value.'); @@ -66,6 +66,12 @@ console.log(fixedValue); // Should print 4
```js -// solution required +// the global variable +var fixedValue = 4; + +const incrementer = val => val + 1; + +var newValue = incrementer(fixedValue); // Should equal 5 +console.log(fixedValue); // Should print 4 ```