基礎類庫
1. console
console.log方法用於在console視窗輸出資訊。 它可以接受多個參數,將它們的結果連接起來輸出。
2. Math
内容
- E
- LN10
- LN2
- LOG2E
- LOG10E
- PI
- SQRT1_2
- SQRT2
以上内容的具體使用請參攷ES5標準。
方法
- abs
- acos
- asin
- atan
- atan2
- ceil
- cos
- exp
- floor
- log
- max
- min
- pow
- random
- round
- sin
- sqrt
- tan
以上内容的具體使用請參攷ES5標準。
3. JSON
方法
stringify(object): 將object對象轉換為JSON字串,並返回該字串。
parse(string): 將JSON字串轉化成對象,並返回該對象。
示例代碼:
js
console.log(undefined === JSON.stringify());
console.log(undefined === JSON.stringify(undefined));
console.log("null"===JSON.stringify(null));
console.log("111"===JSON.stringify(111));
console.log('"111"'===JSON.stringify("111"));
console.log("true"===JSON.stringify(true));
console.log(undefined===JSON.stringify(function(){}));
console.log(undefined===JSON.parse(JSON.stringify()));
console.log(undefined===JSON.parse(JSON.stringify(undefined)));
console.log(null===JSON.parse(JSON.stringify(null)));
console.log(111===JSON.parse(JSON.stringify(111)));
console.log("111"===JSON.parse(JSON.stringify("111")));
console.log(true===JSON.parse(JSON.stringify(true)));
console.log(undefined===JSON.parse(JSON.stringify(function(){})));4. Number
内容
- MAX_VALUE
- MIN_VALUE
- NEGATIVE_INFINITY
- POSITIVE_INFINITY
以上内容的具體使用請參攷ES5標準。
5. Date
内容
- parse
- UTC
- now
以上内容的具體使用請參攷ES5標準。
6. Global
内容
- NaN
- Infinity
- undefined
以上内容的具體使用請參攷ES5標準。
方法
- parseInt
- parseFloat
- isNaN
- isFinite
- decodeURI
- decodeURIComponent
- encodeURI
- encodeURIComponent
以上内容的具體使用請參攷ES5標準。