FAQ: Variables - Putting it All Together

This community-built FAQ covers the “Putting it All Together” exercise from the lesson “Variables”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn How To Code

FAQs on the exercise Putting it All Together

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

2 Likes

I am unable to move on from this lesson without getting the solution from the help menu! It seems simple so I don’t know if I am missing something or if it is just a bug.

1 Like

Not able to reproduce this problem. Lesson worked fine for me and let me move on to completion. What browser are you using?

1 Like

I am using Firefox. I reopened it, copied the solution, and pasted it. It wouldn’t allow the pasted solution to proceed either. I think it must be a bug on my end somewhere.

1 Like

Where is the HTML to go with this JS? I thought they both would be accessible. It would to helpful to see how it all works together.

That is not the objective of this module. It’s more about concepts than actual code. You might glean a lot from the HTML and CSS but it would be ahead of the learning curve and you would have more questions than answers, which questions if they do not get answered force you into presumptions.

Bottom line, don’t try to get ahead of the curve, just yet.

4 Likes

Yes, I agree. I’m inquisitive by nature, wanting to know all things :joy:. Thanks. :slightly_smiling_face:

2 Likes

I’m having the same problem as govtchris had, even did the copy paste thing too and it wouldn’t let me pass either. I had to use the help to move on.

I notice in these early examples you’re not declaring variables with var. I know I’m getting way ahead of myself – but is this not the proper convention anymore?

1 Like

Declaring variables is less convention and more intrinsic requirement. In the global namespace a declaration is rather moot, though. For small exercises most of the activity takes place there. Declared or not, variables are all global, in the var sense.

In ES5, var gave variables function scope which prevented them from leaking out into the global namespace. In ES6, let and const give variables block scope which prevents them from leaking into their local scope.

This is vitally important since now it means that even in the global namespace, variables can exist in their own block scope and not collide with global variables. It has relegated var to a legacy keyword that might even one day be deprecated.

1 Like

Is it considered bad coding if you don’t have a space in between the symbols? For example:

two=‘grass’

vs how it should look like

two = ‘grass’

There is no such thing as bad coding, unless it doesn’t work, or doesn’t work correctly all the time. Not having spaces around operators still works. The only thing is it is harder to spot the operators when reading the code.

Style guides generally recommend whitespace around operators. Nothing is said about it making the code better, or not bad. It’s just easier to read and debug.

4 Likes

What does it mean by “set it to the equal value grass”?

Hello @tera5879537475 and welcome to the Codecademy Forums!

// declare variable one
// set it equal to the value 'grass'

This means that we should first declare a variable with the name one. Then we should assign one the value of 'grass'. We declare and initialize variables by using the assignment operator, =.

For example:

greeting = 'Hello world!'

Here, 'grass' is a string and it is assigned to the variable one. Strings are a data type you will learn more about in an upcoming lesson and, in many programming languages, should always be surrounded by either a pair of 's or "s (or either), depending on the language you are using.

3 Likes

Kindly suggest me something good book for reading, for coding, as a second source for backup, after codeacemy,

cuando estamos atascados los mejor es tomarnos 15 min descansar la vista y luego reeler el codigo , sino pedir apoyo a otro programador