You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, what's up! Yeah, the code is solved and functional. It takes the cart object as a parameter and then loops through the array to sum the quantities. checkoutCartQuantity works as the counter, and I placed it inside the function scope so it resets every time the function runs. totalItems stores the final result. I pass the function with its parameter because a function is still a value in JavaScript. Finally, I insert the result into the template string using interpolation.