WebQuest

Variables and Functions

Task

20160411074037WyLyt.png

Variables are containers for storing data values when using JavaScript. There are different types of data to consider:
  • String Data: Characters that are unchangeable over time (For example: var greeting='Go Titans!!!';)
  • Number Data: Represents numeric values (For example: var myAge=16;)
  • Boolean: Represents logical values such as true or false (For example: var skyIsBlue=true;)
  • Undefined: Represents a value that hasn't been defined (For example: var notDefinedYet;)
  • Null: Represents an empty value (For example: goodPickupLines=null;)
Rules for Variable names:
  • Begin with letters, $ or _
  • Should only contain letters, numbers, $ and _
  • Variables are case sensitive
  • Choose names that maximize clarity and meaning
  • Use camelCase for multiple words: Capitalize first letter of each word after the first one (For example: southgateAndersonTitans)
  • Be consistent with your file naming conventions!
Rename the following variables in a way that is acceptable:
  • var 2coolForSchool
  • southgate_anderson_titans
  • titansRule!
Variables can store the result of any expression. For example:
            var x=2+2;
            var y=x*3;

            var name='Mrs. Slivnick';
            var greeting='Hello'+name;
            var title='Web Design teacher';
            var description=name+'is my'+title;
            */Mrs. Slivnick is my Web Design teacher*/

Don't forget: Adding comments to your code will allow you to keep track of your variables in a way that is clear and easy for you to understand. Your comments are only read by you and not the computer, so they can be customized for your own clarity. 

The Public URL for this WebQuest:
http://zunal.com/webquest.php?w=317196
WebQuest Hits: 1,340
Save WebQuest as PDF

Ready to go?

Select "Logout" below if you are ready
to end your current session.