`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]) < 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]) > 0 );{
result="U will reserve atm(y, items[x]) as a remainder";
}
}
vm(2, 3);`
**the error is that it gives me 3 answers as u can see: \\ -2
"U Do not have enough money to pay"
"Ur money just matches the required paying fee"
-2
"U will reserve atm(y, items[x]) as a remainder" \\
\\ also the 3rd result " result="U will reserve atm(y, items[x]) as a remainder" " wont show the remainder
"y goes to the amount of money u hold"
"x goes to the number of items from array"
vm is the vending machine and what it should do is show 1 answer of these up
1- u do not have enough money to pay
2- Ur money just matches the required paying fee
3- is that he has more money and he will reserve " y - items[x] " as remainder
Please when u got my error write me the error and the full code, sometimes it gets hard on me, im still new...