|
|
Log In | Not a Member? |
Contact ADC |
| < Previous PageNext Page > |
JavaScriptでは、Table 1-1に示すとおり、5つの基本型があります。
型 | 説明 |
|---|---|
| 数値。整数および浮動小数点の値の処理が可能。 |
| 論理値。 |
| 文字の並び。 |
| 値なし。 |
| 値は不明。 |
JavaScriptでは、必要に応じて型を自由に変換できます。次のような文があるとします。
var x = 1 + "2"; |
JavaScriptはまず文字列"2"を数値の2に変換し、3という数値をxに代入します。
基本型以外のものはすべてオブジェクトです。基本型は、次のように必要に応じてオブジェクトに昇格されます。
var message = "Hello World"; |
var firstCharacter = message.charAt(0); |
JavaScriptは、charAtメンバ関数を呼び出すために、文字列"Hello World"をオブジェクトに昇格します。
| < Previous PageNext Page > |
Last updated: 2007-06-11
|
Get information on Apple products.
Visit the Apple Store online or at retail locations. 1-800-MY-APPLE Copyright © 2007 Apple Inc. All rights reserved. | Terms of use | Privacy Notice |