From 23a3287d8f72990134445c592743eef426614f41 Mon Sep 17 00:00:00 2001
From: nemogoc <1668286+nemogoc@users.noreply.github.com>
Date: Tue, 8 Oct 2019 05:16:36 -0500
Subject: [PATCH] update test wording for undefined fn returns (#36804)
* update test wording for undefined fn returns, bring code out of after test section and check that the function does what it says it does (rather than just checking the result), update seed, example, and solution
---
...-value-returned-from-a-function.english.md | 39 +++++++++----------
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.english.md
index 6ce2ebb970b..f1d872ac2be 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-undefined-value-returned-from-a-function.english.md
@@ -16,7 +16,7 @@ var sum = 0;
function addSum(num) {
sum = sum + num;
}
-var returnedValue = addSum(3); // sum will be modified but returned value is undefined
+addSum(3); // sum will be modified but returned value is undefined
```
addSum is a function without a return statement. The function will change the global sum variable but the returned value of the function is undefined.
@@ -34,12 +34,12 @@ Create a function addFive without any arguments. This function adds
tests:
- text: addFive should be a function
testString: assert(typeof addFive === 'function');
- - text: sum should be equal to 8
+ - text: Once both functions have ran, the sum should be equal to 8
testString: assert(sum === 8);
- text: Returned value from addFive should be undefined
testString: assert(addFive() === undefined);
- - text: Inside of your functions, add 5 to the sum variable
- testString: assert(code.match(/(sum\s*\=\s*sum\s*\+\s*5)|(sum\s*\+\=\s*5)/g).length === 1);
+ - text: Inside the addFive function, add 5 to the sum variable
+ testString: assert(addFive.toString().replace(/\s/g, '').match(/sum=sum\+5|sum\+=5/));
```
@@ -59,37 +59,34 @@ function addThree() {
// Only change code below this line
-
-
// Only change code above this line
-var returnedValue = addFive();
-```
-
-
-
-
-### After Test
-