I am working on an Angular2 app, in which I need to store items that were added by the user to the shopping cart. For that, I am using local storage to save the items temporarily. Each category (ex. shoes, clothes....) is saved in the local storage as a key; its value is an array that contains all the added items and belongs to the same category `key`.

I have multiple keys, each of them has a value which is an array.
I want to access to the stored keys and also get the length of value of all keys 

Ex:
key 1 has a value that has a length of 5.
Key 2 has a value that has a length of 12.

So the total length is 12+5=17

Any idea on how to achieve that?