question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] - Formatting required in `Introducing Else If Statements`

See original GitHub issue

Describe your problem and how to reproduce it:

The tests appear to require specific (albeit conventionally correct) formatting in order for the code to pass. This code block, provided by a user, did not pass:

function testElseIf(val) {
if (val > 10) {
  return "Greater than 10";
} else  if (val < 5) {
  return "Smaller than 5";
} else {
  return "Between 5 and 10";
}
}

testElseIf(7);

However, if I ran the formatter with Ctrl+Alt+F, the resulting formatted code did pass:

function testElseIf(val) {
  if (val > 10) {
    return "Greater than 10";
  } else if (val < 5) {
    return "Smaller than 5";
  } else {
    return "Between 5 and 10";
  }
}

testElseIf(7);

Add a Link to the page with the problem:

Basic JavaScript - Introducing Else If Statements

Tell us about your browser and operating system:

  • Browser Name: Chrome
  • Browser Version: 85.0.4183.83
  • Operating System: Windows 10 v1909

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ojeytonwilliamscommented, Sep 9, 2020

Hey @yashgupta18. We typically accept PRs in the order we receive them, so this will be open until we get a working PR.

0reactions
yashgupta18commented, Sep 9, 2020

Hi, i am a first timer. Is the issue still open?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing Else If Statements bug? - The freeCodeCamp Forum
Tell us what's happening: So freecodecamp won't accept my answer because it says I don't have two else statements?
Read more >
Formatting of if Statements - Stack Overflow
I find this: if( true ) { DoSomething(); } else { DoSomethingElse(); }. better than this: if( true ) DoSomething(); else DoSomethingElse();.
Read more >
Related "if/else if" statements should not have the same ...
A chain of if / else if statements is evaluated from top to bottom. At most, only one branch will be executed: the...
Read more >
if / else errors - learn how to fix these - Codecademy
In the particular code example above, if the program execution has reached the else statement it means that: a < b returned false...
Read more >
IF, ELSE, ELSE IF Statement in R - Guru99
Note: Make sure you correctly write the indentations. Code with multiple conditions can become unreadable when the indentations are not in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found