please dont rip this site
Microsoft® JScript
JScript Data Types
| Tutorial |


What are the JScript Data Types?

Microsoft JScript has five types of data. The main types are numbers, strings, and Booleans. Others are functions and methods, and arrays and objects. (Methods are functions that are properties of objects; Arrays and objects are handled identically in almost all ways, and are not really distinct as types.) For more information on objects and arrays, see Objects.

String Data Type

String literals are delineated by single or double quotation marks. This permits you to type strings that contain quotation marks. A string is actually an object in JScript, but it is a special case, with special properties, and is best thought of as a data type. (See Objects for more information.)

Some example strings:

"The cow jumped over the moon."                //  a string literal
'"Avast, ye lubbers!" roared the technician.'  //  a string literal
"42"                                           //  a string literal

Number Data Type

JScript supports both integer and floating-point numbers. Integers can be positive, 0, or negative; a floating-point number can contain either a decimal point, an "e" (upper- or lower-case), which is used to represent "ten to the power of" as it appears in scientific notation, or both.

Integers can be represented in base 10 (decimal), base 8 (octal), and base 16 (hexadecimal).

Octal integers are specified by a leading "0", and can contain digits 0 through 7. If a number has a leading "0" but contains the digits "8" and/or "9", it is a decimal number. A number that would otherwise be an octal number but contains the letter "e" (or "E") generates an error.

Hexadecimal ("hex") integers are specified by a leading "0x" (the "X" can be upper- or lower-case) and can contain digits 0 through 9 and letters A through F (either upper- or lower-case). The letter "e" is a permissible digit in hexadecimal notation and does not signify an exponential. The letters A through F are used to represent, as single digits, the numbers that are 10 through 15 in base 10. That is, 0xF is equivalent to 15, and 0x10 is equivalent to 16.

Octal and hexadecimal numbers can be negative, but cannot be less than one. A number that begins with a single "0" and contains a decimal point is a decimal floating-point number; if a number that begins with "0x" or "00" contains a decimal point, anything to the right of the decimal point is ignored.

Some example numbers:

.0001, 0.0001, 1e-4, 1.0e-4  //  Four floating-point numbers, equivalent to each other.
3.45e2                       //  A floating-point number, equivalent to 345.
42                           //  An integer number.
0377                         //  An octal integer, equivalent to 255.
00.0001                      //  As octal numbers cannot have decimal parts, this is equivalent to 0.
0378                         //  An integer, equivalent to 378.
0Xff                         //  A hexadecimal integer, equivalent to 255.
0x37CF                       //  A hexadecimal integer, equivalent to 14287.
0x3e7                        //  A hexadecimal integer, equivalent to 999.
0x3.45e2                     //  As hexadecimal numbers cannot have decimal parts, this is equivalent to 3.

Booleans

The possible Boolean values are true and false. These are special values, and are not equal to 1 and 0.

Note: In a comparison, any expression that evaluates to 0 is taken to be false, and any statement hat evaluates to a number other than 0 is taken to be true. Thus

(false == 0)
evaluates to true. For more information on comparisons, see Controlling Program Flow.


© 1996 by Microsoft Corporation.


file: /Techref/language/asp/js/305.htm, 4KB, , updated: 1996/11/22 10:12, local time: 2024/11/30 16:11,
TOP NEW HELP FIND: 
18.225.149.158:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/TECHREF/language/asp/js/305.htm"> Microsoft&#174; JScript Language Tutorial </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .