Awesome q2a theme

Which of the 2 arguments led to the execution of the if block?

0 like 0 dislike
34 views
const age = +prompt('Age?');
const name = prompt('Name?');

if (age > 18 || name.length > 5) { //Is there away to know which of argumentov led to the execution of the code inside the if block? }


It is clear that inside the if block to check, but it's the repetition of code if (age > 18 || name.length > 5) { if (age > 18) {...} if (name.length > 5) {...} }
by | 34 views

2 Answers

0 like 0 dislike
Impossible.
by
0 like 0 dislike
If age > 18, age, for all other cases name, and check it again does not make sense.
by

Related questions

0 like 0 dislike
7 answers
asked Mar 28, 2019 by pokupo
0 like 0 dislike
2 answers
asked Jun 11, 2019 by JomCol
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users