Assessment/help wanted for "Testing your skills: Conditionals pt. 2"

When I put my code into ‘codepen’ it tells me that there are no issues, but when I use the integrated window within the article it doesn’t work as intended.

I’m assuming there is something wrong with my syntax but I can not figure it out. I believe that I nested the ‘if… else if… else’ correctly, but can’t figure out why nothing is printing properly.

Sorry if this has a very simple solution, very new to this and really stuck on this one problem for some reason!

code

problem

Hi @resotap and welcome to the community :wave:

When using CodePen you need to only have JavaScript in the JS panel (everything between <script>...</script> from the HTML file). The <script> block in the HTML file can then be removed.

The problem with the code I see is that you have put one curly brace at the wrong line:

/* Your code */
if (machineActive === 'true') {
  /* multiple if...else */
else {
  response = 'Switch the machine on.';
  }
}

/* Correct code */
if (machineActive === 'true') {
  /* multiple if...else */
} else {
  response = 'Switch the machine on.';
}

Can you spot the difference?

When I make this change it works on both CodePen and the integrated editor.

Cheers,
Michael