Math.sqrt( number )メソッド

Math.sqrt( number )メソッドは、引数「number」に指定した数値の平方根を返す静的メソッド。

構文

Math.sqrt( number )

引数

number
平方根を得たい数値を指定する。

戻り値

平方根。

サンプル

<script>
document.write( '<p>Math.sqrt( 1 ) : ' + Math.sqrt( 1 ) + '</p>' );
document.write( '<p>Math.sqrt( 4 ) : ' + Math.sqrt( 4 ) + '</p>' );
document.write( '<p>Math.sqrt( 9 ) : ' + Math.sqrt( 9 ) + '</p>' );
document.write( '<p>Math.sqrt( 16 ) : ' + Math.sqrt( 16 ) + '</p>' );
document.write( '<p>Math.sqrt( 25 ) : ' + Math.sqrt( 25 ) + '</p>' );
document.write( '<p>Math.sqrt( 36 ) : ' + Math.sqrt( 36 ) + '</p>' );
document.write( '<p>Math.sqrt( 49 ) : ' + Math.sqrt( 49 ) + '</p>' );
document.write( '<p>Math.sqrt( 64 ) : ' + Math.sqrt( 64 ) + '</p>' );
document.write( '<p>Math.sqrt( 81 ) : ' + Math.sqrt( 81 ) + '</p>' );
document.write( '<p>Math.sqrt( 100 ) : ' + Math.sqrt( 100 ) + '</p>' );
document.write( '<p>Math.sqrt( 2 ) : ' + Math.sqrt( 2 ) + '</p>' );
document.write( '<p>Math.sqrt( 3 ) : ' + Math.sqrt( 3 ) + '</p>' );
document.write( '<p>Math.sqrt( 5 ) : ' + Math.sqrt( 5 ) + '</p>' );
document.write( '<p>Math.sqrt( 6 ) : ' + Math.sqrt( 6 ) + '</p>' );
document.write( '<p>Math.sqrt( 7 ) : ' + Math.sqrt( 7 ) + '</p>' );
</script>

↓↓↓出力結果↓↓↓

スポンサード リンク

カテゴリー: JavaScript, Mathオブジェクト, メソッド, リファレンス, 組み込みオブジェクト タグ: パーマリンク