Quote generator question

I’m really new to all this but I don’t understand how I put the “output” from the function in the html text.
Here’s a link to what I’ve done this far
https://codepen.io/tindrutt/pen/KKPOKQp

let arrayQuote

but you use

arrayQuotes[Math.floor(Math.random() * arrayQuotes.length)]

and

getElementByID

is wrong

getElementById

is right.

i’m probably an idiot but i still cant figure it out, it feels like i’ve tried everything.
https://codepen.io/tindrutt/pen/vYBopBv

In the last step you have to call the function. Just like this:

myFunction(newQuote);

i think i’ve done that? or do you mean in the html? i’m so confused lool

In JS. But have some other errors too. :frowning:

document.getElementById(‘#text’).innerHTML

Do not use the # . Just simple

document.getElementById(‘text’).innerHTML

oh thank you but isn’t this right?
myFunction(newQuote) { document.getElementById('text').innerHTML = quote; }
or how do you mean with the function?

function myFunction(newQuote) { document.getElementById(‘text’).innerHTML = newQuote ;
}
myFunction(newQuote);

The last line / var quote = … / is not necessary.

OMG ITS WORKING thank you sm i’ve been trying this the last two days omgg wow thank you

1 Like

:slight_smile: You’re welcome. Calm down and keep going, you are on good way.

1 Like