Jonas: So, here goes my solution
to the coding challenge.
We start by defining the variables;
so var, mass-Mark, equals...
Let's say it's, seventy-eight;
and you could use any numbers that you wanted to here,
so I didn't define what the masses and heights were,
just remember that they have to be in kilograms.
Let's give us some more space here...
So, we have mass-Mark, then we have height-Mark,
let's say one-sixty-nine meters;
so not, not really tall.
Okay, and we could declare all of these variables here
in one line, but I'm not going to do that right now.
I'm just going to declare them one after the other.
So, Mark and now John; ninety-two kilograms,
and then the height,
and so that's step number one, I think.
Now next step, calculate both their BMI's.
And so, BMI-Mark is Mark's mass
divided by the square of his height.
So height-Mark times height-Mark again,
and then body mass index-John, so mass-John,
divided by height-John times height-John.
So. That was step number two, and now we will
want to create a boolean, to determine
if Mark has a higher BMI than John.
So, var, Mark-higher-BMI, and so all we have to do
is BMI-Mark, greater than BMI-John.
So, that should be our boolean variable,
and now we can log it to the console.
So, is-Mark's, and now we cannot just write
a quotation mark, to write "Mark's" because then
that would be outside of the string.
So, this marks the beginning of the string,
and this, the end of the string,
but we still want to have the symbol here to say "Mark's,"
and so what we have to do is to escape this quotation mark,
and we do that by adding this back-slash.
Okay? So that is called escaping.
And that's something really common in programming as well.
So, "Is Mark's BMI higher than John's;"
and now again we need to escape, and then close that string.
So, we have our string "Is Mark's BMI higher than John's;"
actually, we want to ask the question,
and then we say "plus,"
and now you know that is an operator,
and so we basically add strings together.
And then Mark-higher-BMI, which,
should show whether it be true or false.
So, let's load it; and so, is Mark's BMI higher than John's?
And it says true. And let's actually also
log these two BMI's to the console,
just so that we're sure if everything's working correct.
So console dot log, and remember that we can actually
log two values to the console at the same time,
simply by adding the comma here.
Okay, so, Mark and John, and so we see
that the first one is twenty-seven, so Mark is twenty-seven,
and John is twenty-four.
And so Mark's BMI higher than John's;
and of course, yeah, it's true.
Because, of course, this here will return true,
so it will give us the result of "true,"
which will be assigned to Mark-higher-BMI.
Okay. So that's the solution to the challenge.
Of course, you could have done it differently,
as long as the solution is the same.
So in programming, many, many times,
there's not just one correct solution,
there are many, many ways to solve the same problem.
Okay? And that's something very important
that you should know, and that you should keep
in mind always when you're programming.
So there's not one correct way to solve a problem,
there are always many, many ways,
and so if you solved this in a different way,
which is still correct, then it's absolutely valid,
and it's great that you found a different way
of solving this from my way.
And so, yeah, let's now move on to the next video.