Linux Today: Linux News On Internet Time.

JavaScript Data Types

Feb 03, 2009, 02:32 (1 Talkback[s])
(Other stories by Thomas Valentine)

"Data Types - Number
In JavaScript, every number data type is treated as a floating-point number. A floating-point number is a number that includes a decimal place. For example, the fraction one-half wouldn't be written as .5, but as 0.5. Multiply that 0.5 by 6.1234 (or any number, really), and the decimal (the "point") will have "floated" to a new position within the new number. Hence the term "Floating Point". Because of this floating-point capability, JavaScript is great to use with numbers. Combine this with its loosely typed nature and you get a very easy to use and flexible yet powerful programming language.

"Within the Numbers data type, there are a few different variations that must be addressed. Understanding these variations is crucial to your skill in working with them. As with most concepts within JavaScript, they are easy to understand. Along with the different number types are several built in number values that can be used within your scripts. The different types and built in values are as follows. Integers

"An integer is a number that exists without a decimal place. It is a whole number. For example, the number 5 would be an integer, but the number 5.5 would not be due to the existence of a decimal place. An integer may be positive or negative. An integer may be stated as a decimal, octal, or hexadecimal number. The below list explains what is meant by the terms decimal, octal, and hexadecimal."

Complete Story

Related Stories: