I am doing a quote display site by learning from youtube. I have a curiosity about a problem. When i press the button, it comes same quote two or more than two times but sometimes, not always (I use Math.random() so it can be usually). I want that when i press the button, it will change, not will stay at the same quote.
I have no idea, so i didn't do anything.
const quotes = [
    {
        author: 'Ramiz Karaeski',
        quote: 'Meyvayı soymadan içinden ne çıkacak bilemem, kardeş.'
    },
    {
        author: 'Franz Kafka',
        quote: 'Beyinlerimiz savaşsın isterdim ama görüyorum ki silahsınız bayım.'
    },
    {
        author: 'Fyodor Dostoyevski',
        quote: 'Cehennem nedir? Sevginin artık imkansız olduğuna dair çekilen bir acıdır.'
    },
    {
        author: 'Lev Tolstoy',
        quote: 'Herkes dünyayı değiştirmeyi düşünür, ama kimse kendini değiştirmeyi düşünmez.'
    },
    {
        author: 'Charles Bukowski',
        quote: 'İnsan her zaman ihanet eder sonunda. Kimseye güvenme.'
    },
    {
        author: 'Friedrich Nietzsche',
        quote: 'Oysa güzelliğin sesi kısıktır konuşurken; sadece en uyanık ruhlara yanaşır.'
    },
    {
        author: 'Sabahattin Ali',
        quote: 'On beş günlük ömrü on beş seneye sığdıramazsın da, on beş senelik ömrü on beş günde yaşayıverirsin!'
    }
]
const quoteAuthor = document.getElementById('author');
const displayQuote = document.getElementById('quote');
const buttonChange = document.getElementById('button-change-quote');
buttonChange.addEventListener('click', change);
let random = 0;
change();
function change() {
    random = Math.floor(Math.random() * quotes.length);
    quoteAuthor.innerHTML = quotes[random].author;
    displayQuote.innerHTML = quotes[random].quote;
}
 
     
     
     
     
     
     
    