corrected conditionals (#29295)
previous version passed the tests, but were only relevant to the numbers tested, not what the question was asking for.
This commit is contained in:
		| @@ -11,7 +11,7 @@ Here’s a solution: | ||||
| In the function body we need to add multiple ```conditional operators``` - as in our lesson: | ||||
|  | ||||
| ```javascript | ||||
| {return (num === 10) ? "positive" : (num === -12) ? "negative" : "zero";} | ||||
| {return (num > 0) ? "positive" : (num < 0) ? "negative" : "zero";} | ||||
| ``` | ||||
| In this way, function can check if a number is positive, negative or zero. | ||||
|  | ||||
| @@ -19,7 +19,7 @@ Here’s a full solution: | ||||
|  | ||||
| ```javascript | ||||
| function checkSign(num) { | ||||
|   return (num === 10) ? "positive" : (num === -12) ? "negative" : "zero"; | ||||
|   return (num > 0) ? "positive" : (num < -12) ? "negative" : "zero"; | ||||
| } | ||||
| checkSign(10); | ||||
| ``` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user