0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

JavaScriptにおける演算子

Posted at

基本

qiita motto.js
val = num1 + num2;
val = num1 * num2;
val = num1 - num2;
val = num1 / num2;
val = num1 % num2;
qiita motto.js
//pi
val = Math.PI;
//Napier's constant
val = Math.E;
//2 四捨五入
val = Math.round(2.4);
//3 切り上げ
val = Math.ceil(2.4);
//2 切り捨て
val = Math.floor(2.8);
//8
val = Math.sqrt(64);
// 絶対値
val = Math.abs(-3);

val = Math.pow(8, 2);
// 最小値のみ出力
val = Math.min(2,33,4,1,55,6,3,-2);

val = Math.max(2,33,4,1,55,6,3,-2);
val = Math.random();

1~20の範囲でランダムに出力

qiita motto.js
val = Math.floor(Math.random() * 20 + 1);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?