It depends on the trade-in value of your current car. if the trade-in value is higher than $40K (Eg. $50k) and the used car is cheaper (Eg. $30k), then the loan will be offset, meaning you'll get back $10k from selling your car, and this amount can be used as a downpayment for the used car that you're buying.
10 months ago