Guys, i am a newbie and I hope to get some advice and help on a javascript function which can balance an equation.

Example `(n1)x - (n2)y = z`

, where `z === 0`

.

My current script draf as below:

```
var z = x * n1 - y * n2;{
if (n1 < n2){
x * n1 - n2 = z;
} else if (n1 > n2){
n1 - y * n2 = z;
} else {
n1 - n2 = z;
}
}
var balance = function (n1 , n2){
if (z === 0){
console.log(x, y);
} else {
for (x||y = 0; x||y < 100; x||y++){
if (z != 0){
continue;
}
console.log(x, y);
}
}
balance(2,8);
```

As example I want to balance the value for `x`

and `y`

for `2x - 8y = 0`

, where `2 > 8`

, so `2x + 8 = 0`

and `x`

will increase to a value which the result will be `0`

.

For information my current function didn’t work at all and I don’t know what’s the mistake in my script. Can anyone please help me?