This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Animate Your Name Forum

View Course » View Exercise

514 points
8af9ae84405a83e615b89858b5ea8bae?s=140&d=retro
Submitted by
deanskee
over 3 years ago

12/15 [resolved] Decisions Decisions

Im confused about the If and else statement in the example... What does the 10<3 pertain to... Is it the numbers in the arrays? Why choose 10 and 3? Why can't it be

If you could explain the reason behind those random numbers and what they pertain to/ why those numbers... that would greatly be appreciated. Thanks


0 votes

permalink

Hi Dean,

Here is how if/else statements work:

if (this is true) {
    do this thing;
} else {
    do this other thing;
}

In the example in the exercise, the (10 < 3) is nothing special, except for the fact that it is false. that will cause your if/else statement to "do this other thing". If you want it to "do this thing" then you will need to make sure that what is in the ( ) is true.

There are endless expressions that you could put in the ( ) that will be true. Here are a few examples:

1 === 1
1 <= 20000
1 != 42
"Dean".length === 4
true
!false

Have you been through the JavaScript Track exercise where they explain Comparison Operators yet?

3698 points
55df2afa95e3787b9200005e_359368177
Submitted by
Judy
over 3 years ago


0 votes

permalink

That does not help

73 points
2bbe0c6833d2259768c8dbc9048b8eb2?s=140&d=retro
Submitted by
BunnyLover245
over 3 years ago

1 Comment

55df2afa95e3787b9200005e_359368177 Judy over 3 years ago

Tell us what sort of help you need BunnyLover.


0 votes

permalink

Hi Dean,

I see that you have a working Animate Your Name codebit now so I have marked your question as [resolved] - good work!

3698 points
55df2afa95e3787b9200005e_359368177
Submitted by
Judy
over 3 years ago