Chaining If Else Statements help me plz give me answers

Tell us what’s happening:

Your code so far

function testSize(num) {
  // Only change code below this line
  if (4) {
  return "Tiny";
  }  else if (5) {
return "Small";  
  return "Change Me";
  // Only change code above this line

// Change this value to test

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:

In pseudocode you’ve written:
If 4 say “Tiny”. Else, if 5, say “Small”.
The code is broken because it’s not a conditional statement and will always return “Tiny”. It’s also incomplete.

1 Like

wat do you mean ? wat you mean

In your if statement should be more like Psuedocode: if this variable ( in this case num) is 4 then do something

you are saying if 4 then do something It’s probably going to already read the 4 as true, and always return as “Tiny”


Check your conditions, read the challenge carefully, what the condition needs to be in order return “tiny”?

also worth the read:

You have a function named testSize that takes the argument (num), that means the chained if/else statements must also include (num) somehow (e.g. “if (num = 4) { return “whatever”}”)

thanks thanks thanks

This is just an advice, but seeing how you wrote your code I’d say you don’t fully understand functions and parameters? I would highly recommend going back to that lesson to fill up any holes. If you cannot understand a concept taught in the FFC curriculum you can always try to learn it from another source. You just have to Google somehing like “javascript function tutorial” and you’ll find tons of results.

I tell you this because the FFC JavaScript curriculum is not very beginner friendly and there are some things it doesn’t explain in full detail.