Question: A junior programmer comes to you with some code that appears not to work. Can you spot where he went wrong? Give him a hand

A junior programmer comes to you with some code that appears not to work. Can you spot where he went wrong? Give him a hand and correct the mistakes.

var userAge = prompt("Please enter your age");if (userAge = 0) {; alert ("So you're a baby!"); } else

if (userAge = 0) {; alert ("So you're a baby!"); } else if (userAge < 0 | userAge > 200) alert("I think you may be lying about your age"); else { alert ("That's a good age"); }

Step by Step Solution

3.36 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Oh dear our junior programmer is having a bad day There are two mistake... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Beginning JavaScript Questions!