function test(n) {
let y = 0
let x = y / 2
while (y < n) {
console.log('add');
y++;
}
console.log(y);
console.log(x);
}
test(6);
//x prints out 0 instead of 3
x
is supposed to change as y
changes. How do I keep these variables synchronized?