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 Introduction to Programming Basics Variables

K Jo
K Jo
7,283 Points

Connecting the the text files to the browser?

I have my Chrome browser pointing to my index.html file. However, changes to my .js file are not being recognized in the browser. Since the title of this course is "Introduction to Programming", I am a bit surprised that the videos do not really walk through the basics of setting up the .html and .js files and ensuring that the browser points to them. The video barely mentions text editors, then all of the sudden the index.html file is on the screen. I downloaded sublime text based on some of the recommendations in the Q&A, but have not had much luck getting the updates in my .js sublime text file (which is in the same directory as my index.html file) to transfer to the chrome browser. Since the instructor points to localhost/ (which appears to be a local server based on the Q&A, but is never really discussed), I cannot tell where I am going wrong?

The videos are good so far, I am just surprised that this introductory course seems to break things down in less detail than some of the more advanced courses. In my (very limited) experience, the setup is often more frustrating than the actual coding.

"For the JavaScript basics course, you can download the files that I use in Workspaces. Here's a link to those files: http://treehouse-code-samples.s3.amazonaws.com/Treehouse_JavaScript_Basics.zip"

If that's the case, why aren't they included in the video itself? How can you possible expect us to know where to find them?

Dave McFarland
Dave McFarland
Treehouse Teacher

Hi JoJo Trotter

These are the files for the JavaScript Basics course. They are included on the video page. For example, go to http://teamtreehouse.com/library/javascript-basics-2/introducing-javascript/where-does-javascript-go, and below the video you will find a "Downloads" tab. Click that tab, then click the link to the Project Files to download them.

4 Answers

Dave,

With the abundance of comments to this video and its predecessor, shouldn't the Treehouse staff have added a video that links the html course to the Java course and covers set up?

Dave,

I viewed this video and it only tells how to use Workspaces, not a text editor like Sublime Text.

Dave McFarland
Dave McFarland
Treehouse Teacher

Workspaces really is just a text editor -- it's just online. To do the same in Sublime you just open the web page and type the code that attaches the JavaScript file to the page. This is the same code that I talk about in my video. For the JavaScript basics course, you can download the files that I use in Workspaces. Here's a link to those files: http://treehouse-code-samples.s3.amazonaws.com/Treehouse_JavaScript_Basics.zip

Perhaps the name of the class is a bit off as it is really designed for an introduction to Javascript. It appears there is an assumption that the student will have taken html and already get how to set up the html file as well as how to use sublime. In any case, I think I understand what you are saying. Let me try to help. If you are using Chrome and Sublime, make sure that you have your index.html and myscript.js open in Sublime. Then make sure that you have your index.html open in Chrome. This will allow you to view the index.html as a webpage (albeit an ugly one). Now that you have your index.hmtl open in both Sublime and Chrome and your myscript.js open in Sublime, go to Chrome and open the Developer tools (upper right hand corner three horizontal bars). Navigate to more tools --> Developer tools. You will see the developer tools open in a split window under your index.html tab. You should see a menu of options across the top of this split window including "Elements" , "Network", "Sources" and so on. The last one should be Console. Click that and you can view the results of your myscript.js file and any subsequent changes you make to it. In this particular video, there will be no visible changes to index.html in the browser - only in the console section of the developer tools. Instead of navigating to "developer tools" you can also navigate to "JavaScript Console" and get to the same place. I hope this helps.

K Jo
K Jo
7,283 Points

Britton - Thanks for the answer; however, that is exactly what I have been doing but still no luck in the console. I'm not sure if it's an issue of how/where I saved the files. Specifically, I have done the following:

1) Created a folder on my desktop named "introtoprogramming" 2) Created the index.html file as instructed and saved it into the introtoprogramming folder 3) Created the myscript.js file as instructed and saved it into the introtoprogramming folder 4) With the index.html file and myscript.js files open in Sublime Text, I opened the index.html with Chrome, then opened the Console under developer tools in Chrome. 5) Made sure the files were saved in Sublime Text and refreshed in Chrome.

There is nothing on the webpage, nor in the console (both are blank).

Sublime Text keeps asking me to purchase the product, so perhaps it has something to do with that (but unlikely).

I have done a number of the other courses, so I am familiar with the concepts and syntax being discussed (just not the setup). So it is not the end of the world if I cannot get it to work (I am more interested in the ruby on rails courses later in this track). However, I wanted to raise the question in case anyone else had the same issue and to make sure TeamTreehouse staff knew that the videos forego a few things in the setup process that could be helpful given the title of this course is likely to attract students with little to no programming experience.

In any event, thank you for your response and let me know if you see anything wrong with what I have described doing above.

Hi Kevin,

Sounds like you have done everything correct. The solicitation to purchase Sublime will have no effect. Sounds like it might be something simple such as incorrectly typed name or file path or it was saved in a different folder. I have done both. One thought - Im not sure how your opening the index.html file, but I like to open the folder and drag the file onto my browser window. This will help verify that the file you are working on is in fact the file you are viewing. Just thinking out loud at this point. Are you able to post a screenshot?

K Jo
K Jo
7,283 Points

Thanks Britton. I will take a look at these thoughts and see if that fixes the issue.

If this class is assuming a basic html knowledge, then its a knowledge that the Treehouse basic html class did not cover....