I am learning about the conditional statement in my JavaScript course and I came across the compound conditional statement and nested conditional statement. Could anyone explain the difference and how it could be used, maybe with some examples?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Compound statements are statements using two or more logic operations.
if (condition1 && condition2) { /* stuff */ }
Nested are just what it says on the tin, they're statement block within statement block.
Both examples yields the same result here. You'll use both types in more complex scenarios.
do && and || have the same meaning in Javascript as Java?
Yes. && - and; || - or.