counters != countersWorking; SOLVED

Hey everyone as for the title I am having trouble with my counters not working. They are itemCounts and discountCounts. They are arrays that hold the value of ITEM_NAMES.length and DISCOUNT_NAME.length. This is a school practice project and those are the values I was given but I am not sure on how to use them to count the number of time the item or discount has been selected. Usually I would just use……….. BARRROOOOOO!!!

I literally just figured out what my problem was. I just realized I am using arrays and because I am also using an if statement to check if it is the correct item I could just used that array point like so:

itemCounts[0]++;

I guess I was overthinking it the whole time because I was scared of failing and looking stupid.

Well thanks for your help?

The project is a gist here;

原文链接:counters != countersWorking; SOLVED

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容