Random quote machine, need help!

Hello everyone!

I have little problem with syntax on random quote machine project. Does anyone have idea why it shows me syntax error?

Code: http://codepen.io/piorys/pen/wWAyNk

Thank you in advance

There are a few issues with how your jQuery is structured. Since you’re using jQuery, the document.getElementById can be shortened, as shown below. I changed the name of the var random to “item” just so there isn’t a readability confusion between that var and Math.random(). Lastly, you have “random” in quotes when passed to innerHTML(). It’s a variable name, so it does not require quotes.

Here is an alternative version:

$(document).ready(function() {

$("#quote-button").click(function() {
var item = quotesArr[Math.floor(Math.random() * quotesArr.length)];


1 Like

You don’t know how grateful I am for your help. There is a long way ahead of me :slight_smile: