鞏固基礎 global物件Math物件

2021-08-03 11:36:47 字數 918 閱讀 5724

全域性的global物件,ecmascript中沒有定義直接訪問它的方式,在js中是作為window物件的一部分實現的。

根據規範,所有不從屬於其他變數的屬性和方法都是global的屬性。

屬性:特殊值undefined、nan、infinity,原生引用型別建構函式object、array、function、date、error、regexp、boolean、string、number。

方法:isnan()、isfinite()、parseint()、parsefloat()、encodeuri()、encodeuricomponent()、decodeuri()、decodeuricomponent()、eval_r()等

另乙個math物件:

math.min()

math.max()

var a=[m,n,j,k]

math.ceil(),天花板--向上取整

math.floor()地板--向下取整

math.round()--四捨五入

產生隨機數公式:math.floor(math.random()*可能值總數+起點數) //可能值總數=h-l+1

其他方法:

math.abs(num) //絕對值

math.exp(num) 的num次冪

math.log(num) //num自然對數

math.pow(num) 

//num的pow次冪

math.sqrt(num) 

//num平方根

------------//下面是x的三角函式

math.cos(x)

math.sin(x)

math.tan(x)

math.acos(x)

math.asin(x)

math.atan(x)

math.atan2(x)

Java基礎鞏固系列 物件流

示例 public class testobjectintoutputstream catch exception e finally catch ioexception e 物件的序列化過程,將記憶體中的物件通過objectoutputstream轉換為二進位製流,儲存在硬碟檔案中 test pu...

global全域性物件

和window差不多,在瀏覽器裡執行的時候,一些全域性的屬性,f就掛到了window中,在node.js中,我們就可以把全域性變數屬性和方法就掛到global物件中,global 屬性自帶幾個比較常用的屬性和方法的 比如commonjs buffer 代表二進位制的處理 prosess consol...

建立Mat物件

mat畫素點的儲存方法 mat的資料型別 cv 8u 8bit unsigned integers 0 255 8 bit unsigned integer uchar cv 8s 8bit signed integers 128 127 8 bit signed integer schar cv ...