Below is my code, why does the value of y change?
what does var y = x | 5;
mean?
code
var x = 0;
for(x; x < 11 ; x++)
{
var y = x | 5;
console.log("\nx: "+x+ " y : "+y)
}
The result is
x: 0 y : 5
x: 1 y : 5
x: 2 y : 7
x: 3 y : 7
x: 4 y : 5
x: 5 y : 5
x: 6 y : 7
x: 7 y : 7
x: 8 y : 13
x: 9 y : 13
x: 10 y : 15
why the value of y
changes based on x
.
On what basics y
is calculated?