Hi, I have the following code in codepen: link
var quotes = [
'“All war is a symptom of man\'s failure as a thinking animal.” ― John Steinbeck',
'“Strictly speaking, we do not make decisions, decisions make us.” ― José Saramago',
'“The only way to deal with an unfree world is to become so absolutely free that your very existence is an act of rebellion.” ― Albert Camus',
'“A lie is more comfortable than doubt, more useful than love, more lasting than truth.” ― Gabriel García Márquez',
'“Try again. Fail again. Fail better.” ― Samuel Beckett',
'“No man chooses evil because it is evil; he only mistakes it for happiness, the good he seeks.” ― Mary Shelley',
'“The constant happiness is curiosity.” ― Alice Munro',
'“Always do sober what you said you\'d do drunk. That will teach you to keep your mouth shut.” ― Ernest Hemingway',
];
function show() {
document.getElementById("ShowQuotes").innerHTML = quotes[0];
}
window.onload = show;
function next() {
for (var i = 0; i < quotes.length; i++) {
var nextquote = //Aquí es donde me pierdo.
}
document.getElementById("ShowQuotes").innerHTML = nextquote;
}
What I want is that by clicking on next the next element of the array is displayed but I can not see how I could do it. I also want to know how I could push them back when clicking on another link.
I hope that please someone can help me, I would like it a lot because as you can see I am very new with javascript.