Ask Question

Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Everytime someone clicks the "addItemButton", she would like the variable to increase by 1. What code should Jasmine insert where it says in order for her app to work? a. cart total = 1. b. cart total + 1. c. cart total = cartTotal + 1. d. var cart total = cartTotal + 1. e. var cart total + 1.

+4
Answers (1)
  1. 10 April, 10:26
    0
    b. cart total + 1

    Explanation:

    A. cart total=1 do increment the total with every 1 click here, it only 're-assigns cart total with value 1 for every click, hence it's always 1.

    B. In every click, 1 is always added to the previous value of cart total, like addItemButton (cart total+1) or so.

    C. This would have worked too if "cart total" and "cartTotal" where of same type.

    D. cart total is just being initially defined here.

    E. Likewise here, var shows that cart total has just only been declared.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Everytime someone ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers