javascript - TypeError: null reference error -


I'm learning codecademy javascript code and I do not really understand why this gives me this error:

TypeError: Unable to retrieve the property 'Magazine' of the undefined or empty reference

  1. Type the add method, which has a parameter, the itemost Add itemCost to the total
  2. We wrote partial scan method for you and started a switch statement. Add the following 2 items to the switch statement:
    • "Magazine", 4.99
    • "Chocolate", 0.45

      Finally, use the scan method to buy 2 eggs and 3 magazines. Scan: {item} {switch} (case) {case "eggs": this. (0.98) add; break; Case "milk": this.add (1.23); break; // Add another 2 items here Case 'Magazine': this.add (4.99); break; Case 'Chocolate': this.add (0.45); break; } Back true; }}; Cash registrar ['eggs', 'eggs', 'magazine', 'magazine'] console.log ('your bill is' + cash registrar);

      It looks like you get too many bits, but you get a typo And in some ways the scan function is using it incorrectly.

      In JavaScript, the work is calendered with brackets, not the brackets you have. In addition, the scan () function takes an item in the form of parameters, not an array (or multiple parameters).

      To scan an 'egg', the code will look like this:

        cashRegister.scan ('egg');   

      It should take you back on track.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -