You've doubtless used Scratch's
if-then and
if-then-else blocks. They're important fundamentals for achieving almost anything of interest in a program.
Javascript has the exact same idea, called if and if else.
The basic idea looks like this:
if (some condition) {
// bunch of statements to be done if condition is true
}
else {
// bunch of statements to be done if condition is not true
}