Example files from the review session on Feb 20, 2016. Each of these Javascript examples is intended to conceretely demonstrate an important JavaScript concept.
index.html
is used to load each of these files into the browser. Replace the existing script
tag with any of the example files to load other examples.
You can probably run index.html
straight from your file system or you can use a simple http server like this one: http-server.
Just running these files as-is won't be terribly useful. Try writing them yourself first and then looking at the answer files. I highly encourage you to run each of these many times, each time modifying a small piece of the code and adding break points or log statements to see how your changes affect the values you're working with. For example: what happens if you try to nest a bunch of functions inside of each other? Which variables are available in which scope? What happens if you modify variables in a loop? What happens if you create new variables in a loop? What happens if you name two variables by the same name in the same scope? What happens if you try to name two variables by the same name in different scopes? etc.