diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.english.md index f8feea3427..087f3de7b2 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.english.md @@ -19,7 +19,7 @@ You may read it as "get the field x and copy the value into a ## Instructions
-Use destructuring to obtain the average temperature for tomorrow from the input object avgTemperatures, and assign value with key tomorrow to tempOfTomorrow in line. +Use destructuring to obtain the average temperature for tomorrow from the input object AVG_TEMPERATURES, and assign value with key tomorrow to tempOfTomorrow in line.
## Tests @@ -28,9 +28,11 @@ Use destructuring to obtain the average temperature for tomorrow from the input ```yml tests: - text: getTempOfTmrw(AVG_TEMPERATURES) should be 79 - testString: assert(getTempOfTmrw(AVG_TEMPERATURES) === 79, 'getTempOfTmrw(AVG_TEMPERATURES) should be 79'); + testString: assert(getTempOfTmrw(AVG_TEMPERATURES) === 79); - text: destructuring with reassignment was used - testString: getUserInput => assert(getUserInput('index').match(/\{\s*tomorrow\s*:\s*tempOfTomorrow\s*}\s*=\s*avgTemperatures/g),'destructuring with reassignment was used'); + testString: getUserInput => assert(code.match(/{[\S\s]*\w+\s*:[\S\s]*\w+\s*}\s*=\s*(avgTemperatures|AVG_TEMPERATURES)/)); + - text: The key tomorrow was destructured from AVG_TEMPERATURES + testString: getUserInput => assert(code.match(/{[\S\s]*tomorrow\s*:\s*tempOfTomorrow[\S\s]*}\s*=\s*(avgTemperatures|AVG_TEMPERATURES)/)); ```