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


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
23 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 | 23 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 12, 2019 by JomCol
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
36,634 users