Archive for August 7, 2007

JavaScript Data Types

Posted in JavaScript on August 7, 2007 by Joey

JavaScript supports the following data types::

Number: JavaScript supports both integer and floating-point numbers. Examples are 3 and 3.33.

String: Examples are “Joey JavaScript” and “Today is Monday.”

Boolean: Represents true and false values.

null: Has no value. It means the variable holds nothing.

undefined: Used to check for the existence of a variable or whether the variable has been assigned a value yet.

Commenting JavaScript Code

Posted in JavaScript on August 7, 2007 by Joey

There are two ways to comment JavaScript code. If only one line of code needs to be commented, use two consecutive forward slashes:

//This is a JavaScript single-line code comment

To comment a block of code, do the following:

/*
This is a JavaScript
code block comment
*/