Breakthrough or confusion?

function orderMyLogic(val) {

  if (val < 10) {

    return “Less than 10”;


  else if (val < 5) {

    return “Less than 5”;


  else {

    return “Less than five”;



// Change this value to test


This is what I am working on at the moment. Feel my brain is about to make a breakthrough! 

Ok, I got it by looking at the solution. Sometimes the instructions on can be a little confusing. But what I learnt is:

If the “if” statement is true then the code stops there. There is no need to go any further. 

If the “if” statement is not true it moves to the “else if” statement.

If this also is not true the code executes the “else” statement.  

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s