
|
|
|||||||||||
JavaScript VariablesData typesIn the previous section, JavaScript Syntax, we looked at a variable set to a string. We call a string a data type, as it is a type of information that a variable can hold. But variables can hold so much more. Here are some examples of variables being assigned different datatypes:
Remember, only strings, or snippets of text, need to be quoted. You can also use numbers with decimals; these are called float values. You can assign any variable to any of these values, like this: somevariable = 'Some text'; Creating variablesVariable names must begin with a letter or an underscore, and can
have letters (both capital and lowercase), numbers and underscores.
Variable names are case sensitive: You should also use the var keyword when first creating a variable, like so: var myName = "Josh"; With the var keyword, you can also create multiple variables at the same time: var myName = "Josh", has_happened = true; Now, let's take a look at JavaScript functions.
|
||||||||||||
| About the NetVisits, Inc Network | Write For Us | Advertise Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy. |
Visit other NetVisits, Inc. sites: |