JavaScript Basic Variables


Variables: In JavaScript variables are containers for storing data values. (string, number, boolean)

When to useUse when you have a value you would like to use more then once in your code.


JavaScript File:

//Variable type STRING, Holds a finite sequence of characters (i.e., letters, numerals, symbols and punctuation marks).
var Name = "Crocodile";

//Variable type Number, Holds numeric values.
var Bounty = 81000000;
//Variable type Boolean, Holds a true or false value.
var Pirate = true;
alert("Name: "+ Name + "\n" + "Bounty: "+ Bounty + "\n" + "Is a Pirate: "+ Pirate + "\n" );

HTML File:

Java Variables</title>
        <script src="Variables.js"></script>


Challenge Problem