I am totally lost with the Random Quote Machine

I am a beginner with no previous Javascript knowledge and I’m having difficulty connecting the button with the ability to view and change quotes in Javascript. I have added the button in html but how do I add the quotes in Javascript? I’ve looked online and found this code:

var quotes = new Array();
    quotes[0] = "Don't be so humble - you are not that great.";
    quotes[1] = "Moral indignation is jealousy with a halo.";
    quotes[2] = "Glory is fleeting, but obscurity is forever.";
    quotes[3] = "The fundamental cause of trouble in the world is that the stupid are cocksure while the intelligent are full of doubt.";
    quotes[4] = "Victory goes to the player who makes the next-to-last mistake.";
    quotes[5] = "His ignorance is encyclopedic";
    quotes[6] = "If a man does his best, what else is there?";
    quotes[7] = "Political correctness is tyranny with manners.";
    quotes[8] = "You can avoid reality, but you cannot avoid the consequences of avoiding reality.";
    quotes[9] = "When one person suffers from a delusion it is called insanity; when many people suffer from a delusion it is called religion.";

var nextQuote = 0;
var textField = document.getElementById("textField"); 

function buttonClickHandler() {
    if(nextQuote < 10) {
    } else {
        if (window.nextQuote == null) {
   window.nextQuote = 0 
} else {
    textField.value = quotes[nextQuote];

Can someone help me with the html and Javascript part of it? Thanks.

Actually, that is not going to generate a random quote, instead it will return the next quote on the array. I’m using React so I don’t think I can help too much, but here is my machine https://github.com/Oxyrus/Wonka (I’m still working on it) but it works.

You should be using textField.textContent not textField.value.

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

Check out this challenge to refresh your knowledge of assigning click handlers. Also, use jQuery.

this code simple iterates through the array from 0 to 9, and places that string in the textField ID.

if you’ve gone through all the challenges prior to the quote machine front end project you’ll have been exposed to some jquery, arrays and random numbers.

To connect a button click to your html, you’ll need to write jquery or javascript (messier code) that looks for a “click” event, then grabs the random quote and adds that quote to a field in your HTML by that ID.

I think if you redo or go over the jquery challenges again with this in mind it will make more sense.

What about doing it this way?

This will show a new quote each time you click the button.

New Quote!

This is with html and adding javascript to it. Can anyone tell me how to add the ability to add more quotes to this code? Thanks

Yeah that seems right but what about doing it this way?

This will show a new quote each time you click the button.

New Quote!

How could I add more code that would allow me to add more quotes. Thanks

Do you have a new sample or link to your pen? I don’t see any new code