Almost totally lost on Build A Random Quote Generator

This is my first post. I’ve been struggling with the “Build a Random Quote Generator” challenge for five days now and made next to no progress. After completing all the lessons leading up to it, I feel egregiously unprepared for this challenge. I did some searching, found this tutorial and followed it:

That’s obviously not the whole challenge, but it didn’t work. After trying to think through it on my own with no luck, I tried literally copying the code from the tutorial letter for letter. It still didn’t work. So I started searching around and found a bunch of other people’s executions of the challenge on codepen—none of them worked either. I looked through FCC’s example project and found the Javascript so loaded with non-core functionality I couldn’t really parse what the problem might be. I’m just struggling to get the basic functionality to work, never mind making it look fancy.

So, I’m now lost. I’m not convinced the code is the problem, and it might be something Codepen specific. Or maybe I just totally don’t get it and should back up and retake some of the lessons, but I don’t know where to start with that either, because, like I said, this challenge feels like it’s full of stuff the lessons barely touched on, if at all.

I need really some kind of guidance. I need to see the functional bits working, without being clouded with aesthetic stuff. Or, maybe I’m just fundamentally misunderstanding something about using codepen. If I export from codepen and try to execute locally with safari, I’m told “ReferenceError: Can’t find variable: math”. I thought math was a built in function.

This is the link to my pen:

It’s almost an exact copy of the tutorial above, but doesn’t work. I haven’t fussed with API’s or the twitter thing at all yet, I’m still just trying to generate quotes. I’m stuck at a dead end. Can someone help?

You had some capitalization errors in your JS function. You wrote:

function newQuote() {
  var randomNumber = math.floor(math.Random() * (quotes.length));
  document.getElementByID('thisQuote').innerHTML = quotes[randomNumber];
}

It should be:

function newQuote() {
  var randomNumber = Math.floor(Math.random() * (quotes.length));
  document.getElementById('thisQuote').innerHTML = quotes[randomNumber];
}

Capitalization is important in JS. It is equivalent to a spelling mistake. There are four, “math” twice, “Random”, and “ID”.

Don’t worry, this happens all the time. With experience you’ll still make these mistakes sometimes, but you’ll find them faster.

Yes, the tutorials are not comprehensive. You’re expected to do some research on the side. Just take it step by step, make incremental changes to your program, and when stuck - Read-Search-Ask.

You’ll get there.