From 929e0db6333fbf54b335cc0fbdfa070a1d59a08b Mon Sep 17 00:00:00 2001
From: Ben Brown <9870007+brownben@users.noreply.github.com>
Date: Mon, 3 Dec 2018 08:49:57 +0000
Subject: [PATCH] fix(challenge): use-the-conditional-ternary-operator (#19535)
---
...he-conditional-ternary-operator.english.md | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.english.md
index 7e71afe8f3..4f7c9ef2e6 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.english.md
@@ -17,7 +17,7 @@ This can be re-written using the conditional operator
:
## Instructions
-Use the conditional operator
in the checkEqual
function to check if two numbers are equal or not. The function should return either true or false.
+Use the conditional operator
in the checkEqual
function to check if two numbers are equal or not. The function should return either "Equal" or "Not Equal".
## Tests
@@ -26,14 +26,13 @@ Use the conditional operator
in the checkEqual
functio
```yml
tests:
- text: checkEqual
should use the conditional operator
- testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code), 'checkEqual
should use the conditional operator
');
- - text: checkEqual(1, 2)
should return false
- testString: assert(checkEqual(1, 2) === false, 'checkEqual(1, 2)
should return false');
- - text: checkEqual(1, 1)
should return true
- testString: assert(checkEqual(1, 1) === true, 'checkEqual(1, 1)
should return true');
- - text: checkEqual(1, -1)
should return false
- testString: assert(checkEqual(1, -1) === false, 'checkEqual(1, -1)
should return false');
-
+ testString: assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code), 'checkEqual
should use the conditional operator
');
+ - text: checkEqual(1, 2)
should return "Not Equal"
+ testString: assert(checkEqual(1, 2) === "Not Equal", 'checkEqual(1, 2)
should return "Not Equal"');
+ - text: checkEqual(1, 1)
should return "Equal"
+ testString: assert(checkEqual(1, 1) === "Equal", 'checkEqual(1, 1)
should return "Equal"');
+ - text: checkEqual(1, -1)
should return "Not Equal"
+ testString: assert(checkEqual(1, -1) === "Not Equal", 'checkEqual(1, -1)
should return "Not Equal"');
```
@@ -62,7 +61,7 @@ checkEqual(1, 2);
```js
function checkEqual(a, b) {
- return a === b ? true : false;
+ return a === b ? "Equal" : "Not Equal";
}
```