I wanted to know if someone could help me, I'm doing an exercise in javascript in which I collect cookies I leave the code:
window.onload = function(){
var contador = 0;
do{
contador=contador+1;
var cookieLeida=getCookie("carrito"+contador);
//alert(cookieLeida);
var datos = cookieLeida.split("&");
//alert(datos);
insertaCookie(datos[0],datos[1],datos[2],datos[3],datos[4]);
}while(cookieLeida!="");
}
What I do is assign an accountant because my cookies store them with the name cart and an accumulated one, that is, my cookies are cart1, cart2, etc, so until they are stored everything works well for me and picks up the cookies without problems, but also returns a last cookie in white for the structure of the while, my question is if someone can tell me how to prevent me from returning that blank cookie or ignore it so that it does not show it on the screen when adding the data of the cookie in an array. Thanks in advance