The external file must be ASCII text with the file extension .js. Do not use the beginning and ending tags in the external .js file.
|Boolean||bTest = true;||A logical value that is either true or false.|
|Number||nNum = 32;||An integer or floating pointvalue.|
|String||strString = “hello”;||A string of characters.|
A variables that is not assigned a value is type NULL;
– variable names are case sensitive.
– To define a hexadecimal number, prefix the number with 0x.
– You can use single or double quotation marks to enclose a string value.
– If a variable is string type and you want to use it in a mathematical operation, use the built-in function ParseInt() or ParseFloat() to convert the string to a number.
– If a variable is type Number and you want to use it in a string, use the toString() method.
The alert method accepts a string between quotation marks inside the brackets. You can enter a literal string, as shown above, or you can enter the name of a string variable. When you use the name of a string
variable you don’t need the quotation marks. You can use the procedure described above to experiment with the examples provided in this tutorial.