  function something()
  {
  	var x = window.localStorage.getItem('bbb'); // x = hh['bbb']

  	x = x * 1 + 1; // x = x + 1

  	window.localStorage.setItem('bbb', x); // hh['bbb'] = x

  	alert(x);
  }

function add_to_cart(id)
{
	var key = 'product_' + id
	
	var x = window.localStorage.getItem(key);
	x = x * 1 + 1;
	window.localStorage.setItem(key, x);
}

@@ -253,10 +253,9 @@
  id%0A
-%09
 %0A
+
 %09var
@@ -349,8 +349,348 @@
 , x);%0A%7D%0A
+%0Afunction cart_get_number_of_items()%0A%7B%0A%09var cnt = 0;%0A%0A%09for(var i = 0; i %3C window.localStorage.length; i++)%0A%09%7B%0A%09%09var key = window.localStorage.key(i); // get key%0A%09%09var value = window.localStorage.getItem(key); // get value, same as in Ruby: hh%5Bkey%5D = x%0A%0A%09%09if(key.indexOf('product_') == 0)%0A%09%09%7B%0A%09%09%09cnt = cnt + value * 1;%0A%09%09%7D%0A%09%7D%0A%0A%09return cnt;%0A%7D

add cart_get_number_of_items function