Conditional Logic with If Statements vs If Else Statements. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Conditional Logic with If Statements vs If Else Statements.

https://code.sololearn.com/W13wufi2r7VC/?ref=app I came across a problem that I found on the web/book recently suggesting that conditional logic with if statements may be more appropriate when running tests. However, I managed to solve the same problem with an If/Else statement. As I'm getting a bit more familiar with JavaScript, I was wondering what really the most practical way to write code that compares booleans? I would appreciate it if someone with work experience or a computer science background would give me an honest answer. Also, if you see anyway to improve on my code, please push me in the right direction. Thank you very much. P.S. I wrote code to generate HTML elements for the tests that were ran both for practice and to let people get a glimpse of the results without having to look at the console. However, I hope that you would check the console to make sure that there aren't any generated bugs.

21st Oct 2020, 9:29 PM
Kenneth Fullbright
Kenneth Fullbright - avatar
1 Answer
+ 2
Martin Taylor Thank you very much for your detailed advice. This helps me out a lot.
21st Oct 2020, 10:14 PM
Kenneth Fullbright
Kenneth Fullbright - avatar