function AddToCart(id,price, show_tovar, pr){ myArr2=[$.cookie("tovar")]; if(myArr2 == ''){ var myArr2=[]; } myArr2.push([id,price, show_tovar, pr]); $.cookie("tovar", myArr2); console.log(myArr2, myArr2 instanceof Array, myArr2 == null); }