Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables The Variable Challenge

Andrea Sanchez
Andrea Sanchez
2,118 Points

Am I the only one who thinks this challenge is hard?

I pass all the quizzes easily yet, I don't know where to start with this challenge. I wish there was at least a guide on how to do this challenge rather than just throwing you in and making you do it from scratch.

Yes I am finding this to be incredibly bifficlt

jordychinchin
jordychinchin
1,964 Points

You're not the only one. I've been going through JavaScript basics pretty smoothly so far but seem to have hit a wall with this challenge.

Nathan Labish
Nathan Labish
Courses Plus Student 2,165 Points

I think people must all learn differently. I am brand new to javascript (really everything) and I find this challenge wonderful! It is very refreshing and stimulating (for me) to use the information I learned in the earlier videos to create something without all the "monkey see, monkey do" handholding. But then again as a kid I always used my legos to build my own designs and my brother always wanted his to look just like the picture. I don't think either way is "better" but this challenge is just what I like! I wish we could see each others stories I'm sure yours is really good!

10 Answers

Steven Parker
Steven Parker
231,271 Points

This is a bit tougher than the auto-checked challenges, but this time you also have another video that shows and explains a sample solution. Give it your best shot, but if you can't quite work it out, just watch the next video.

Andrea Sanchez
Andrea Sanchez
2,118 Points

Question, so this may be a silly question but I'm going to ask anyways.

It seems like there can be countless ways of writing a piece of code and have the same output, correct? I think that's what I'm having trouble with. It's almost like writing. You can write a sentence in many different ways but convey the same message? Is that correct?

Steven Parker
Steven Parker
231,271 Points

Yes, that's very true. The more complex the program, the more ways there are to code it. But you will learn about "best practices" which will help to narrow down the choices to the ones that are likely to lead to compact code that performs well and is easy to maintain.

Noah Fields
Noah Fields
13,985 Points

This is exactly correct. A simple example was discussed earlier:

message += 'abc';

is identical to

message = message + 'abc';

in terms of the output - that is, what it does as far as the user of the program is concerned. Having said that, just like there's a such thing is a grammatically correct but ugly sentence, there can be code that works, but still isn't "good". Ultimately, the goal is to write code that does the following:

1: Does what you want it to do. This is obvious - if you write a program and it doesn't work like you want it to, you need to change something to make it work right.

2: Does it quickly and efficiently. This won't be a problem for some time, but really, really, really large programs may take a long time to do what you tell them to. Maybe you're searching through a list of millions of variables, trying to find all the ones that fit some complicated set of requirements. It might take two hours to search all of it if you write it in one way, but maybe there's a better way to write it that only takes one hour.

3: Is readable. Two years later, you may want to go back to your program, or maybe someone else is using your code and changing it for their own needs. Even if your code works, and works well, if everything is mashed together, spacing is strange, and variable names are vague, then it's going to be a real pain figuring it all out.

Andrea Sanchez
Andrea Sanchez
2,118 Points

I had to watch the next video to get an idea how to do the project. I'm not quite there yet to just whip something up. Plus I don't learn well that way. I learn by being shown then applying it.

Steven Parker
Steven Parker
231,271 Points

You'll find the "from scratch" challenges rather rare. Most of any course will be videos, mini-challenges, and quizzes.

You are not alone. Starting out on something new is scary, but the videos help and we are still just learning. besides, he did say we will still have questions and we should not be experts at this point.

Andrea Sanchez
Andrea Sanchez
2,118 Points

Thanks Kingsley. I think when I finish the entire track, I'm gona do it again.

Kingsley Felix
Kingsley Felix
8,591 Points

That's good, another thing is to learn know the basics, what to connect where, etc then move to frameworks as they make things easier

Bruno Brito
Bruno Brito
3,652 Points

Not giving up is a big part of becoming a programmer. I almost quit a couple times, but hey, most of the people I know in this field felt the same way many times. There is nothing wrong feeling this way, just keep going. To me repetition works wonders. Watching the videos more than once and then trying to do my own code is helping me move forward. If I get stuck I just Google a lot or check the correct answer and then try to do it on my own.

Tl,dr: DonΒ΄t quit.

Matus Kotulak
Matus Kotulak
1,921 Points

Andrea, its easy. Look at the instructions.html. In each line you have written answer already. I also though its hard at first look. But on second... :-)

Taylor Belk
Taylor Belk
3,157 Points

I found it easier to come up with what I wanted the string to say first and just pick which parts of that could easily be inputted by the user. The biggest part of this one was the(( var name = prompt('Type something please'); )) if you understand that the rest is easy peasy. I had a hard time the first time I tried to learn JS too. I gave up for a few weeks and came back.

Andrea Sanchez
Andrea Sanchez
2,118 Points

This challenge kinda discouraged me.

Kingsley Felix
Kingsley Felix
8,591 Points

Don't let it get you down, you can do it. don't get discouraged over 6 lines of code what happens when you see 100s and thousands lines of code.

continue with the course. skip anyone giving you issues

Goodluck.

sami thakur
sami thakur
970 Points

cmon its not that hard :/

Luis Roman
Luis Roman
1,511 Points

This also happened to me. It almost made me quit. It got the best of me. Made me upset and angry. lol. However, after a day of just doing my normal routine I thought to myself, why am I angry or why should I be upset? This is like that one test or exam in a class from our past where we didn't score very high, but still passed that class, subject or course. I also thought to myself, I can always go back and continue learning. I can continue to practice till the day it becomes second nature.

Kristaps Balodis
Kristaps Balodis
3,643 Points

I enjoyed this challenge very much. Personally, I would like to see more of the same as it gives you opportunity to move the grey matter while learning not during experimentation with your own projects. You get a quick feedback and can compare solutions, which is not the same with personal coding adventures.

I tried couple of approaches and luckily for me they all worked.

I just started this challenge Wow. I am going to fumble through it for a while before I watch the video of how to.

Gabriel Rumbaut
Gabriel Rumbaut
2,476 Points

Fumble through it! I started learning to code a few months ago, and this was exactly how I felt when I started JavaScript. I was totally lost and confused. The most important thing, though, is to keep working at a solution until you find it--don't just skip ahead. I learned SO MUCH just by doing that.

Just keep reminding yourself that there definitely is an answer out there and that YOU CAN FIND IT. All you need to do is keep trying--even if it takes a day or two.

Whatever you do, don't give up. It'll click one day, and you'll be able to blow through this solution easily.

yeah, but I think this is the basic thing that you can do in JS, the JS language has a good reference like this https://developer.mozilla.org/pt-BR/docs/Web/JavaScript

Here's how I did it

var verb = prompt("enter a verb"); var adj = prompt("enter an adjective"); alert("are you ready?"); Document.write("the boy wanted to" + verb + "but he could never do it, because the night was just + adj");

Paul Costanza
Paul Costanza
6,357 Points

Make sure not to put the adj inside the string, because it is a variable :)

I'm writing down your formula. I noticed the last concatenate line, the quotes should end after "just". "but he could never do it, because the night was just" + adj );
Thanks for the structure.