I'm using the module 'ngCart' to act as a shopping cart for a website and I am trying to set up an additional way to implement a voucher system my app.
so far, my method looks like this:
ngCart.applyFiveVoucher = function(){
if(ngCart.setFiveVoucher) {
this.totalCost() -= 5
}
but is returning:
ReferenceError: Invalid left-hand side in assignment
I understand that you cannot alter the return of a function but I am unable to edit the method within the module as these changes will not be passed on if other people try and use my repo. Any suggestions?
You cannot assign to a function result.
ngCart.applyFiveVoucher = function(){ if(ngCart.setFiveVoucher) { return this.totalCost() - 5; }