Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Adam Dingle
Adam Dingle
5,582 Points

Extra Credit - Javascript - fizzbuzz

Couple questions, can you actually earn the extra credit in some courses? I see some challenges in the javascript course I'm in, but nowhere to submit.

Second question is whether you can post to the forum without it being a question. Is there some etiquette to consider?

Moral of all of this was I did the fizzbuzz extra credit and was pretty happy with myself for getting it right and wanted to share the coding I used with the community incase it helps someone else.

Here's how I got fizzbuzz to work:

for (var counter = 100; counter; counter = counter - 1) { if (counter % 3 == 0 & counter % 5 == 0) { console.log("fizzbuzz") } else if (counter % 3 == 0) { console.log("fizz") } else if (counter % 5 == 0) { console.log("buzz") } else { console.log(counter) } }

2 Answers

The extra credit isn't submittable, so the color of the star icon doesn't change. It's just a little side project idea to reinforce what you've learned throughout the lesson. I've seen some comments where students wish they had some points or a badge tied to them, but I kind of like that they don't provide anything more than a learning opportunity. It's like real life. :D I definitely recommend completing them whenever possible.

I don't think you have to post a question to the forum. Pretty much what you just did looks perfect to me. It's filed under JavaScript without being tied to a specific course, which seems right. I think it's great to share ideas, and I'm pretty sure the mods and staff would agree.

If you haven't posted much in the forums, take a second to check out a markdown guide so that you know how to post links and code in a way that's easy to read. There's a link to a cheatsheet at the bottom of every post submission box. That way if you run into any problems and need help (or want to share future discoveries!) you can present it all fancy-like. :)

For example:

for (var counter = 100; counter; counter = counter - 1) {
    if (counter % 3 == 0 & counter % 5 == 0) {
        console.log("fizzbuzz") }
    else if (counter % 3 == 0) {
        console.log("fizz") }
    else if (counter % 5 == 0) {
        console.log("buzz") }
    else { console.log(counter) } }

(I added indentation to your code, but it's otherwise unchanged.)

Thanks for sharing! It's always satisfying to be able to show off your work and get feedback, and it builds community.

Adam Dingle
Adam Dingle
5,582 Points

Thanks for answering my questions Keri!

I had a feeling it was just for me to practice and gauge where I was at with my learning, but figured it wouldn't hurt to ask. Who knows, maybe there was someone out there trying to get it right but couldn't find a place to ask.

I definitely haven't posted much in the forums and will check out the markdown cheatsheet for any future posts. I had a feeling that my coding should have looked better. haha.

Anyways, thank you again. I appreciate it!

No problem. Glad to help. :)