Newer
Older
website / site / js / randomQuote.js
@lagfra lagfra 17 days ago 1 KB random quote
var arr = [
    {"quote":"Me encanta la bicicleta", "author":"Yunior, Holguin"},
    {"quote":"La vita necesita más café y menos estrés", "author": "Café Maguana" },
    {"quote":"Sta rottura de cojoni dei fascisti", "author": "Ivano Ceccarelli" },
    {"quote":"It never gets easier, you just go faster", "author": "Velominati" },
    {"quote":"Respect the earth; don’t litter", "author": "Common Sense™"},
    {"quote":"Impara, Fai, Insegna", "author":"Ciclofficina Ciclostile" },
    {"quote":"Never lift your bike over your head", "author": "Velominati"},
    {"quote":"Padre Pio amico degli sbirri", "author": "Heavy Merda" },
    {"quote":"Come un serpente indotto a camminare", "author": "Attrito"},
    {"quote":"Fight for your right to party", "author": ""}
];

function random(arrayLength)
{
    return Math.floor(Math.random() * arrayLength);             // Math.random() returns a random number between 0 (inclusive),  and 1 (exclusive).
}

function generateRandomQuote()
{
    var randomNumber = random(arr.length);                   // 0 to 14
    document.getElementById("quote").innerHTML = arr[randomNumber].quote;
    document.getElementById("author").innerHTML = "<br>" + "[" + arr[randomNumber].author + "]"
}

generateRandomQuote();