Random Quote Generator Project review

Hi there,
I’m working on a Random Code Generator project using HTML, CSS, and JavaScript. As part of the instructions, We are to Create a function named getRandomQuote which:
• selects a random quote object from the quotes array.
• returns the randomly selected quote object

I wanted to know if my function accurately does what the instruction says because I’m not so sure.
Below is my code.
Thanks!!!

// An array of Objects with the quote and source as properties
var quotes = [
    {
        quote: "In the end, it’s not the years in your life that count. It’s the life in your years",
        source: "Abraham Lincoln",

    },
    {
        quote: "Don’t gain the world and lose your soul, wisdom is better than silver or gold",
        source: "Bob Marley",

    },
    {
        quote: "Lighten up, just enjoy life, smile more, laugh more, and don’t get so worked up about things",
        source: "Kenneth Branagh",

    },
    {
        quote: "Don’t cry because it’s over, smile because it happened",
        source: "Ludwig Jacobowski",

    },
    {
        quote: "Do stuff. Be clenched, curious. Not waiting for inspiration’s shove or society’s kiss on your forehead. Pay attention. It’s all about paying attention. Attention is vitality. It connects you with others. It makes you eager. Stay eager",
        source: "Susan Sontag",

    }
];


// getRandomQuote function selects and returns a random quote object
function getRandomQuote() {
    var randomQuote = Math.floor(Math.random() * quotes.length);
return randomQuote;
}
function getRandomQuote() {
var quoteIndex = Math.floor(Math.random() * quotes.length);
return quoteIndex;
}

Forgive me but I dont understand the referencing part, where I reference it to the quote object

Please what about this function?


function getRandomQuote() {
var quoteIndex = Math.floor(Math.random() * quotes.length);  // selects a random quote
return quotes[quoteindex];  // returns the random quote
}

Thanks for the feedback