Evaluate the following modulus expressions in your head, then use a JavaScript console to check their values:
Determine whether the following expressions are true or false:
!true || !false
(true && !false) && (false || !true)
(4 > 5) || true
("this" != "that") && ("zebra" > "aardvark")
((4 >= 6) || ("grass" != "green")) && !(((12 * 2) == 144) && true)
Use a while loop to write a program that calculates and shows the value of 210 (2 to the 10th power).
Rewrite the solution of the previous exercise using a for loop instead of a while loop.
Run the following and record the result:
alert(Math.floor(3.25));
Invesigate the function Math.floor(...) by conducting a series of “experiments”, calling it with different arguments until you can describe what it does.
Run the following several times, recording the result after each “experiment”:
alert(Math.random());
Compare your results with those of your classmates. Are your results the same or different? Keep running new experiments until you think you understand what Math.random() does. Write a sentence that describes what this function does.
Combine what you learned from the previous two exercise to create an expression using both Math.random and Math.floor to generate a random integer between two variables, high and low, where high is greater than low.
Use the expression you created in the previous exercise to generate two random integers, opr1 and opr2 (short for “operand”). Then use these two new variables to modify the program in the break statement section to use your new random integers instead of 2 + 2.