Js, function not working : <pre><code>`var y = 0 ;
var x = 0;
function atm(num1, num2){
console.log((num1 - num2));
return num1 - num2 ;
}
var items =[1,2,3,4,5,6,7,8,9,10];
function vm(y, x){
if( atm(y , items[x]) &lt; 0  ){
    result = "U Do not have enough money to pay";
}
else if ( atm(y , items[x]) === 0  );{
    result = "Ur money just matches the required paying fee";
}
if ( atm(y , items[x]) &gt; 0  );{
    result="U will reserve atm(y, items[x]) as a remainder";
}
}

vm(2, 3);`
</code></pre>

<p>**the error is that  it gives me 3 answers as u can see:
\\
-2</p>

<p>"U Do not have enough money to pay"</p>

<p>"Ur money just matches the required paying fee"</p>

<p>-2</p>

<p>"U will reserve atm(y, items[x]) as a remainder"
\\</p>

<p>\\ 
also the 3rd result "  result="U will reserve atm(y, items[x]) as a remainder" " wont show the remainder</p>

<p>"y goes to the amount of money u hold"</p>

<p>"x goes to the number of items from array"</p>

<p>vm is the vending machine and what it should do is show 1 answer of these up </p>

<p>1- u do not have enough money to pay</p>

<p>2- Ur money just matches the required paying fee</p>

<p>3- is that he has more money and he will reserve " y - items[x] " as remainder</p>

<p><strong>Please when u got my error write me the error and the full code, sometimes it gets hard on me, im still new...</strong></p>
