Skip to content

Conversation

@Nishant9771
Copy link

The issue in these code is that the if statement is not properly enclosing the line.

Without curly braces {}, only the first statement after the if condition is considered part of the if block.

By adding curly braces around the code inside the if statement, we ensure that both console.log and evenNumbers.push are executed only when the condition num % 2 === 0 is true.

Thank You!

The issue in these code is that the if statement is not properly enclosing the line.

Without curly braces {}, only the first statement after the if condition is considered part of the if block.

By adding curly braces around the code inside the if statement, we ensure that both console.log and evenNumbers.push are executed only when the condition num % 2 === 0 is true.

Thank You!
@Nishant9771 Nishant9771 reopened this Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant