Whats the syntax error?

var myString = function(subtotal,taxRate) {
  var salesTax = subtotal * taxRate;
 salesTax = parseFloat(salesTax.toFixed(2));
 return salesTax;

myString2 += myString(1500, .0625);
1 Like


If this is your full code, then the error is myString2 . This is undefined. Look, if you define it first like var myString2=0 before the last line, then you will get the result 93.75

And if you do not want to define it before the last line, then you have to change the last line like this var myString2 = myString(1500, .0625) without a + sign.

Hope, you got the point.

1 Like