Exercise: Using an array

Modify this example so that if password is not entered, one of four possible responses is chosen at random.

Note:

Hints:

  • Use an array to store the possible answers.

Solution to the exercise

Here is a possible solution to the exercise.

Note:

Hints:

  • undefined
1
2
window.onload = startFunction;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
<!DOCTYPE html>
<html lang="en">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX