I am new to java-script and not able to understand the use of | operator in following code snippet
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a number between 0 and 1</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var a=Math.random();
var x = ((a*2 | 0));
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>