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

Justin Warren
Justin Warren
7,805 Points

Confused about Javascript overall. Quick question: Does the code build on itself? So var apples= 5 at top of screen is

affected by the code that follows it? Example - var apples =5 and then functions/code is written that affects and changes what "apples" is?

Also if anyone has any other good resources to supplement this learning. I just would like to have some very basic foundational knowledge, b/c I feel like I'm watching the videos but it's just not sinking in!

2 Answers

Steven Parker
Steven Parker
216,045 Points

If I understand what you're asking, the nature of code is that variables will get changed during the course of the code. If they don't need to change, the modern practice would be to declare them using "const" instead of "var", which guarantees that they will not change.

There's lots of additional learning material that can be found online, but before you start looking around, consider sticking with your course or track to completion as many times things will suddenly "sink in" in you just continue forward.

Justin Warren
Justin Warren
7,805 Points

Thanks for the response Steven! Yeah I'm in the techdegree program and am chipping away but JavaScript has my head spinning a bit (and a lot more than HTML and CSS for sure). Thanks!

Steven Parker
Steven Parker
216,045 Points

Understandable, as JavaScript is much more about programming than either HTML or CSS, though a few of the more advanced features of CSS do cross the line a bit. Just pace yourself and don't get overwhelmed. Once you get the basics down and start learning about more of the features of the language, I think you'll find it a lot of fun to work with.

Happy coding!