I'm making my way through Murach’s JavaScript and jQuery (3rd Edition) and I've encountered a compiler error with code from the book. I've triple checked my syntax against the book's syntax and I think I can rule it out. I also looked at the errata page and I don't find a reference to the page I'm on.
I also looked at this question, but I didn't find anything applicable to my issue.
Here is my object constructor:
var Invoice = function(subtotal, taxRate) {
this.subtotal = subtotal;
this.taxRate = taxRate;
};
I run into trouble when attempting to add methods to the prototype object:
// The getTaxAmount method is added to the Invoice prototype
Invoice.prototype.getTaxAmount: function() {
// Compiler whines right here ^ and ^
return (subtotal * this.taxRate);
};
// The getInvoiceTotal method is added to the Invoice prototype
Invoice.prototype.getInvoiceTotal: function() {
// Compiler whines right here ^ and ^
return subtotal + this.getTaxAmount(this.subtotal);
};
I'm using Visual Studio Code with Debugger for Chrome. The prompt in VS Code says it wants a ;
at the first spot it complains and [js] identifier expected
at the second spot it complains.
Thank you for reading. I welcome your suggestions.