数学(Math)


DESC 算術計算をするには Math モジュールを利用する。 Static class のため instance は作成できないので、class Method として使う


Math


// 11 Math.ceil( 10.5 ); Math.PI; // 2 Math.floor( 2.2 ); Math.pow( 2, 2 ); // random [0 1) Math.random(); // 1.2 Math.abs( -1.2 ); // 小数点を四捨五入する // 4 Math.round( 4.4 ) // 5 Math.round( 4.5 ) var length = Math.sqrt((x * x) + (y * y));