| about | help | code help+videos | done | prefs |
calculateCost
Write a method that iterates through an array of item names and updates the total cost. Pricing rules: Each "shirt" costs 5 Each "pants" costs 7 All other items cost 10 You should update a variable named cost. calculateCost(["shirt", "shirt", "dress", "blanket", "pants", "shirt"]) → 42 calculateCost(["pants", "pants", "pants"]) → 21 calculateCost(["shirt", "pants", "hat"]) → 22 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy