Common Computer Science References
At the end of this lesson, you will be able to:
understand and use an if statement
debugging and breakpoints in Chrome inspector
all our programs so far have been linear
go over linear flow-charts
go over "Boolean Expression" and "If ... Then"
go over if-then flowchart
diamond is boolean expression
you MUST have a "yes" and "no"
go over difference between "==" and "==="!
== → "is equals"
=== → "is equals AND the same type"!
go over "Random Numbers"
Math.random()
// returns a random integer from 1 to 6 into variable "randomNumber"
const randomNumber = Math.floor(Math.random() * 6) + 1
problem with "pseudo-random numbers" and seeds
create a program that:
ensure your program has a complete GUI and follow all the steps to solve the problem
randomly picks a number from 1 to 6
do not show it to the user, just keep it in memory in a variable
asks the user to pick a number from 1 to 6
use an if ... then statement to tell them if they got it correctly
use a 2nd if ... then to tell them is they got it wrong!
you should place the "random number generation" outside of the function call, so it is run once (1) when the webpage first loads and then does not change; so it is easier to guess!
do the above program in PHP
NOTE: The generation of the random number is outside the function; this is so it is generated just once and does not change. YES, it is a global variable.