Please note - all script results will be this color
Task 1:
Create a form which gathers user input and invokes a function which demonstrates the use of each of the three logical operators (&& || and !):
- Your function should gather user input
- Put a conditional statement inside the function. Use either:
- Demonstrate the && operator. You'll need a conditional which checks that one condition and another condition are met.
- Demonstrate the || operator. You'll need a conditional which checks that either one condion or another condition is true.
- Demonstrate the ! operator. You'll need a conditional which checks that some condition is false (not true).
- You can use all three logical operators in one form/function or do a separate form/function for each - whatever works the easiest for you. This task will be much easier if you use numbers instead of strings for your comparisons. If you use strings, in order to do something which makes sense, you'll need a form with two or more input text boxes.
My function will decide if you are older than me or younger than me.
Task 2:
- Write an array that contains 5 elements (remember in JavaScript your array starts with 0)
- Make one of those elements a special word
- Write a loop to find that word
- Use document.write() to display the word and the number of the element that holds that word
- You'll need a loop with a conditional inside the loop in order to search the array for the secret element.
My array consists of
- Sushi
- Tex-Mex
- Italian
- Thai
- Surf and Turf
Task 3:
Use the faith code to fill array elements with user input and then display the number of elements in the array. To end the program, the user must leave the input box empty and click the button one final time. Because there is nothing in the entry box, the function displays the number of elements in the array and the array contents in the second box.
Your assignment is to write a similar function that does the same thing.
- Declare two global variables - one of which should be a new array. Do not declare elements for the array.
- Write a function that:
- Takes the user input and creates a new array element each time the user inputs data & clicks the button
- Stops when the user leaves the box empty and clicks the button
- Then displays the number of elements and their values that were gathered from the user in the second textbox

Bonus Task:
Create a guessing game. You could use your Task 3 code for this, combine the Task 2 and Task 3 codes, or write something completely new.