Ask Question
23 June, 14:53

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.

+3
Answers (1)
  1. 23 June, 18:13
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers