LoginSignup
1
0

More than 3 years have passed since last update.

jsの>> 説明

Last updated at Posted at 2019-12-31

アプリを作りたいと思いWEBに落ちているコードを参考にしていると、分からないコードがあったのでググったり動かしてみて分かった事を書いていきます。

結論

var x = 23
var x2 = x >> 1;
var x22 = Math.floor(x / 2);

console.log(x2 + ' , ' + x22)  //11 , 11

要するに
x >> p

Math.floor(x / 2**p)
は同じ値を返すということ

1
0
4

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
1
0