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

Create a .js file in Google Chrome

So the "Writing Your Program" video shows the instructor creating a .js file in Google Chrome, but I CAN NOT figure out where he went to do that. It doesn't help that he's using a Mac and I'm on a PC... I've Googled this to death and still can't figure it out. Help!

I had been racking my brain out for hours on this too!!!!!

6 Answers

Erik Nemesis
Erik Nemesis
13,356 Points

Notepad is good but Sublime text is even better.

Actually, he edited and saved both the example "index.html" and "myScript.js" files in a program called Textmate on Mac (see 0:45-1:15 in the lesson video).

The console/repo at the bottom of the screen in Chrome is mostly used for debugging, testing, etc., and I think whatever javascript you input there is only transient.

Since you're on a Windows machine, you could try something like gEdit (https://projects.gnome.org/gedit/) instead of Textmate. I use gEdit because its free, open-source, fully featured, customizable, and is platform agnostic with versions for Windows, OSX, and Linux -- which is really nice if you wind up jumping from one to another occasionally...

Happy coding!

James Barnett
James Barnett
39,199 Points

notepad++ is great text editor on Windows, it's free and an extremely popular choice.

Thanks to both! Those both look great, but I'm gonna go with Notepad++ for now. It just feels more intuitive for me.

Also, I'm still unsure of where exactly I need to save these files so that they will load into the webpage. I'm starting this with zero prior knowledge so sorry if these are dumb questions.

James Barnett
James Barnett
39,199 Points

Create a folder on your desktop and save your HTML & JS files there.

Will the Crimson editor work

James Barnett
James Barnett
39,199 Points

Yep that will work great

I tried and got the site to show using the video http://teamtreehouse.com/library/javascript-foundations/variables/basics I can not get it to show the message it says I should. which tells me it is not getting connected to the myscript.js file it shows on the desktop with it but it shows a error 'console' is undefined. I am not sure what to correct or why it may be supposed to say this but i do not get the desired results anyway. If there is a error I do not know where to find it either.I could do a screen capture and show my work but do not know where to load it to this site

I think I need to find the video on working in a browser? I seem to remember it has something to do with how I save the file on the desk top as well as what I name it . I know in my browser I have to name it htm and not html for some reason .

For anyone still having issues figuring this one - here's what I did. use notepad++ or sublime text or any other editor to create index.html and myscript.js file. Create a folder on desktop and add both files to it. Launch index.html with chrome and then open the dev tool window. Click on the 'console' tab and now refresh your screen. The console will display the js message. Hope this helps.