DEV Community

Discussion on: Issue with Else If Statement

Collapse
 
moopet profile image
Ben Sinclair

if the sum of 2 digits is above 10, but less than or equal to 20, then we can safely assume that both the digits will be less than or equal to 10, but not above 10

This isn't correct. What about 15 and 4, for example? or 20 and 0?

if the sum of 2 digits is greater than 20, but less than 30, then we can safely assume that one digit will be less than or equal to 10, and the other digit will be less than or equal to 20

Try 15 and 14?

I think you've spent a while making these assumptions and then focused on implementing them without trying numbers out. That's what I mean by working it out with a pencil, and by trying the biggest or smallest numbers that will fit to see what happens.

Thread Thread
 
nparekh1979 profile image
nparekh1979

Hey Ben,

Hope all is well !!

To check for yourself, I'd urge you to visit this website:

JSHero.net

Check question 49 - else if exercise

You can check the code and see for yourself.

I am sure I have made some error in understanding this but you may also have a look at it yourself.

Let me know what you find.

Stay Safe !!