JavaScript Conditionals
If
- The code within the block (between the curly braces) will only run if the condition is met, otherwise it will be ignored
- Whether or not the condition is met, any code after the block will be run
Alternative Conditionals
- You can have as many "else if" conditions as you want (or none)
Types of Conditions
- All of the above examples have the value of true
Challenge
Write a script that stores GPA and entrance exam score as variables. If the GPA is higher than 3.5 and the test score is higher than 85,
display to the console "Application accepted", otherwise display "Application rejected". If only one of the conditions is met, display a
message indicating which one failed.
As a bonus, make a web page that has input fields and a submit button, and have it display the result
on the page when the button is clicked.