I know I can customize this in a thousand ways, etc. But the core of the challenge is to press a button and get a random quote, since the lessons before this are about APIs, am i just supposed to go out there, copy and paste some code and have it work? (I have one working and it took me 10 minutes), it feels a bit like cheating. But I did learn about APIs though, a bit.
well i wouldn’t say copy and paste… ask yourself could you do it again, with an understanding and no copy/paste?
other than that, yeh pretty simple
Can we see it?
Yea but it’s just plain HTML:
I find it helps just to write stuff out instead of copy/paste, takes longer but it teaches you something i suppose, the other method i use learn how to do something then keep refering to it when it doesnt work!
I think that there are two points to this project: Being able to research / find an API key and implementing it, and preparing you for the next few API projects that add a few more steps.
When I was having difficulty with the API projects, I looked at some completed projects users posted for review and found that a lot of them were creating their own JSON and working through them with with random function. While that’s one way to get it done, I don’t think it properly prepares you for Twitch and the Weather API projects where fCC essentially gives you the API, but you need to write out the code in order to get it working correctly, and then implementing the other steps required for the app to work according to the instructions.
So in my opinion, yes, I think that it was supposed to be “that easy,” although I agree with other users who have replied… next time I would recommend typing out the code to get the jist. Even leave your own comments so you understand how it works for future projects.
IMHO you should start every FCC project with a blank page. Type out everything starting with your DOCTYPE and build from there, using all your own code with the exception of libraries and frameworks.
The only API I used for my Quote Machine was Twitter, but it still took me a couple of hours. It’s not amazing but it’s functional: http://codepen.io/codeslo_matt/full/VayrOp/
If I’d really gotten serious about this project it would have taken me all day. I could have made it fully responsive, I could have pulled the quotes from an external source using an API, or I could have used quotes from multiple people and had the background image change.
You get out what you put in!
So you verbatim copy/pasted the code from css-tricks.com.
Congratulations! You got +10 to your google-fu and +0 to your JS knowledge
On a serious note, googling for answers is good - it’s called “being resourceful”. If you can find a solution to your problem, there is no point in re-inventing the wheel.
If you could write that code yourself, if you can explain to someone what your code is doing on every line, you are good to go. Add twitter button, some basic styling, submit and move on to the next challenge.
But if you are just copy/pasting the code without understanding what it does, if you can’t change anything in “your” code, you are doing yourself a disservice - in the end we are here to learn and by “cheating” you are only cheating yourself.
Anything is easy if you copy it blindly.
You honestly would’ve learned more from writing it from scratch. Regardless, it’s still the first serious FCC project, and I’m sure you’ll find a challenging one eventually. I would still try writing it from scratch yourself, if not now then later.
I want to try to do that but with the 10 minutes lessons we get in FreeCodeCamp about Apis it’s impossible.
I looked just your first 2 lines of your code and that’s how I wanted to do it and how I will do another one, just adding my own quotes in an array and doing something with .Math.random(). I could do it like that I’m sure. At this point using an API is harder than that solution for me as JQuery and APIs are totally new to me. I’m trying to have a generator from another API is now it’s getting harder.
That sounds like a good plan, I had the people in my coding group do the same thing. Just use a local array.
Don’t be too intimidated by those APIs though. It is normal to take awhile to figure out a query that gets you any sort of response at all, and then once you do you have to find the data you’re looking for, and then write a function that will select only that data.
The key skills for doing that are being able to run a for loop (or use foreach) and a for-in loop. Make sure you’ve got those skills down, and APIs and JSON will get less scary.
Regarding using one’s own data structure v an API, the API approach only works in this case if there’s an API that serves the quotes you want to use. I guess if there isn’t, the real (huge) level up would be to write the API but I personally am not close to that level of dev yet.
Perhaps I am missing something, but nothing happens when I click the Quotes button …?
Guess it’s not that easy after all when it breaks up by itself and you don’t know why =P. It was working pretty well.