Bug in Challenge: Use Multiple Conditional (Ternary) Operators.
See original GitHub issueDescribe your problem and how to reproduce it: Bug - Test for below code fails with error: checkSign should use multiple conditional operators.
function checkSign(num) {
return (num!==0) ?(num>0) ? "positive"
: "negative"
: "zero";
}
console.log(checkSign(10));
console.log(checkSign(-10));
console.log(checkSign(0));
Screenshot -1:
Screenshot - 2:
How to reproduce It. Instead of Error: “checkSign should use multiple conditional operators.” Error should be: Using multiple ternary operators in statement-if-true part of ternary operator is not best practice.
(Increasing clarity of error message)
Add a Link to the page with the problem: Link to Challenge; Link to my post reporting bug on forum:
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (11 by maintainers)
Top Results From Across the Web
Bug in Challenge: Use Multiple Conditional (Ternary) Operators
I think the challenge fails to check for Ternary operators in statement-if-true part of Ternary operator. JeremyLT ...
Read more >How to Use Multiple Conditional (Ternary) Operators in ...
By watching this video, you will learn how to use multiple conditional operators in JavaScript. Thank you so much for watching, ...
Read more >Use Multiple Conditional Ternary Operators - YouTube
Free Code Camp Material - To help you learn and walk-through step-by-step.JavaScript Algorithms and Data Structures SectionBasic Javascript ...
Read more >Im trying to understand the "Conditional (ternary) operator." Do ...
Im trying to understand the "Conditional (ternary) operator." Do these 2 codes mean the same thing? I wrote the if statement.
Read more >Simple And Bug-Free Code With Dart Operators - Medium
The ternary operator already exists in most languages, but we'll discuss it here for a more complete flow. The ternary operator allows a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would be for adding a note similar.
I agree that some tweaking makes sense. I’d would help if we can capture the fact that the test fails if a) you aren’t using a multiple ternary or b) the ternary isn’t in the expected format.