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 Writing Your Program

creating and saving js file in textmate

In this video he has a "Web" file (I guess it is textmate??). Could someone please tell me how to create the "Web" file, the index.html, and the myscript.js? New mac user and new to programming so the more detail the better. Thank you

4 Answers

The "Web" file as you're referring to is a Folder, Directory or what you preference of calling it. So creating a folder is just go into Finder right click and select "New Folder".

The HTML and JS file in the other hand is easier to create in text editor. In this case they're using TextMate. If you want to create ANY file you can easily press the "CMD" + "N" or "Apple key" + "N" at the same time or just select File > New File. It's when you're saving its important to tell the computer what kind of file it is. In case we have a HTML file which should end with ".html" and a JavaScript file which ends with ".js". If you want to save you either press "CMD" + "S" or "Apple key" + "S" at the same time or just select File > Save. When you're saving it it really doesn't matter what name you choose just that it ends with ".html" for HTML and ".js" for JavaScript.

I would recommend that you create a Folder just for just your development. You can call it "Development", "Sites", "Web", "Web Development" etc. and then make a folder for your project like "HelloWorld" or "MyWebsite" etc. Then save your files in the right project folder.

Thank you very much for the detailed response. In the "writing your program video" he is saving all of these in a google chrome file/page. How do I achieve this part (where i am saving everything that I am doing in textmate to the google chrome page. Sorry again for the over simplistic questions.

First he is still saving the file in TextMate. Then he opens them in Chrome. The files are still HTML and JavaScript but what he does is that he opens the web browser console, in this case the web browser is Chrome but you can do the same in Safari, Firefox etc. What you're creating when you create a HTML file is a source code for what the web browser is going to display. If you want to view what your HTML is doing in practice just right click on the file (in this case: index.html) > Open with > Google Chrome. A good practice is to see how all the other browsers is behaving based on your HTML.

Right now I have a "Web" folder saved in "Desktop". In the web folder I have 2 files (the .html and the .js file). It seems like having these saved in the desktop is the wrong place. I have the js console opened up and I also have the html "introduction to Programming" opened in chrome. At the beginning of the video, on the left side, he has the file "Web" and then underneath it the html and js files. If you could just tell me exactly what he is doing there and how to duplicate that I would greatly appreciate it. Hopefully last question. thank you