Hi there,
I am taking the JavaScript course and struggle to understand the below code.
From what I’ve learned, if we use several if statements in a code, all of them should be subsequently executed.
The output of the below function is “Under 25”, but I struggle to understand why it is not “Under 55”. Even if the first condition evaluates to true, so does the second one and if they are executed in an order then “Under 25” should be overwritten by the second condition and return “Under 55”. Why does the code just stop running when the first condition is true? What am I missing here? Now I really don’t get the difference between if and else if.
Thank you for your help!