Math工具函數
1:Math.PI
2:Math.random 返回 [0, 1)範圍的數;
3:Math.floor(); 向下取整數;
4:Math.sin, Math.cos, Math.tan 三角函數
5: 角度轉弧度,弧度轉角度;
0-360是度 0-2*PI 是弧度 一個圓是 2*PI 1*PI大概是3.141592653589793
6: 反三角函數Math.asin, Math.acos, Math.atan;
7: Math.atan2(y, x), 返回一個座標(y, x)對應的角度;(-PI, PI];
8: Math.sqrt 開根號;
數組的高級使用
1:array.length; 獲取數組的長度;
2:遍歷一個數組; for(var key in array);
倆種方法
3: 向數組末尾加入一個元素; push
4: 查找對象在數組中所對應的索引; indexOf()
5: 刪除數組的某個元素; splice(開始索引,要刪除的個數)
6: 數組的排序;
7: 隨機 打亂一個數列;
8:隨機的從一堆的數據裏面抽取一個值;
表的高級使用
屬於模塊類,下一篇詳細講解
1:遍歷一個表; for(key values in table)
2: 刪除表中的數據; delete list_data[4];
字符串對象高級使用
1:str.length;屬性
2: str.indexOf();返回子串首次出現的位置;
3:str.replace(/Microsoft/,"W3School");
4:toLowerCase, toUpperCase;