JavaScript Chapter 4

This chapter was about decisions and loops. I thought they were interesting as things are starting to get mathy.

Basically you can use JavaScript to do different things based on what decision is made. If, if/else, and switch statements can be used for this. Comparison operators( <,=,and >) can be used in these statements to make these decisions.

For example:

if (i>18) {

document.write(“Welcome to the site!”) ;

} else {

document.write(“Sorry, too young.”) ;


for, while, and do/while statements can be used to loop, or perform the same task multiple times.

Leave a Reply

Your email address will not be published. Required fields are marked *