0
2
localStorage is a variable that stores data in the user's browser. In this code, the localStorage.getItem() function is used to get the value of the historial variable. The historial variable is then split on the $ symbol, which separates it into two pieces. The first piece is the string "historial", and the second is a list of links. The for loop iterates through the list, and each link is written to the document. The first line writes "web 1". The next line writes the link data followed by a comma. The next line writes ": " and the link's text. The next line writes "1". The next line writes ": ". The next line writes "2". The next line writes ": ". The next line writes "3". The next line writes ": ". The next line writes "4". The next line writes ": ". The for loop ends, and the code returns to the main program.
Shortcut: linkando
var txt = localStorage.getItem('historial')//pillo el local storage
links = txt.split('$')//lo separas por $
cont=1;//esto es para...
for(i=0;i<links.length;i++){
document.write('web '+cont+' : '+links[i].link(links[i])+'<br>')
cont++;
if((i+1)%4==0){//...que haga el br cada 4 links
document.write('<br>')
cont=1;
}
}