Jump to content

JavaScript/Variables/Exercises

From Wikibooks, open books for an open world

Topic: Declaration and Initialization


Be creative
  1. Explain to your colleague why programs need variables.
  2. Create a code snippet that defines a variable within a block scope. Access this variable within the block scope and outside of the block scope.
  3. Discuss with your colleague the advantages and disadvantages of using the global context.
close