Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140762

Why JavaScript removing decimal values when using or operator? [duplicate]

$
0
0

If i use or operator with a decimal number the decimal points gets cut off from the output

console.log(2.5|0) it prints 2

console.log(5|0) it prints 5

console.log(1000.1|0) it prints 1000

Why is that?


Viewing all articles
Browse latest Browse all 140762

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>