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!
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
Nothing showing up in the Chrome console using console.log "Introduction to Programming"
Hello! I'm having an issue as I try to follow along with the Introduction to Programming videos. Following along with the "Writing Your Program" video I've made .html and .js files in SublimeText, but when I open my .html file in Chrome and open the console, it's blank. I've tried closing and reopening the browser, closing and reopening the text editor, refreshing the page, and that isn't doing the trick. I've pasted the code below and would love some input. Thanks!
My html file looks like:
console.log("Hello from myscript.js");
Ricardo Diaz30,415 Points
Im going to cover over some bases here just in case it was missed. When you say you opened your ".html" file are they named like "index.html" or are they literally ".html"?
Also is there a closing tag for the html? You might have missed it while copying it here but I just wanted to make sure.
When I tried it on mine like this it worked for me. I named it index.html. Let me know if it works.
I just went through this issue.You create the files in your text editor and save them to the files on your desk top. then what you have done shows up in your .js console on your website. did you miss a step if the content you created is in the html file on your desk top it should open as a website then you open the console on the lower half of your website. it should saying Introduction to programming ect. I will stay watching this post and help if you like.
Hi Bruce, thanks for answering! I do have both files saved in the same folder, one as a .js and one as a .html and both were created in the SublimeText text editor. I then opened the .html file in Chrome, which displays the "Introduction to Programming" website, but when I open the Chrome console using Ctrl+Shift+I, it's blank. Does that sound right?
I tried moving the files to the desktop in case that made a difference, but it didn't seem to help. I'm assuming it must be a problem with either the content of my .js file or the link in my .html file. Any ofher suggestions?
I think you have to save your work to the desk top as you work in the .js file. The process is you work in the text editor and save your work to the desk top. If you watch the video that is what Jim is doing then when he refreshes the website his work shows up on the console. I had problems i did not catch that there was a console and they had to show me how to find it. You seem to know how to use the console. That is also one more issue I found I just kept the files on the desk top separate. not in a folder like they mentioned what connects the two is the script <script src="myscript.js"></script> not that they are in the same folder. they are in the same editor anyway . The console will be empty until you start using the .js file as long as you follow what Jim is doing it should show up the same time his shows up. Your html file must be working as long as it says "Introduction to Programming" . If you make a mistake in coping the code it will show up as a error on the console. If you have more issues I will stay online or come back every now and then.
I am wrong you should see "Hello from myscript.js" in the console as soon as it is saved to the .js file on your desk top. If not there must be an issue. This has to be in your .js file: console.log("Hello from myscript.js");
All I can think of is are you hitting save then refresh every time you make a change. I hope I am getting this right this is my first few days in java script as well. I feel like the blind leading the blind.
Thank you so much for your help! I had left off the closing tag, and I added the script type from your code that wasn't in mine. Everything is working now.
Bruce, thank you for your help and for continuing to check in as well.
Off to power through some more lessons!
Hi Jamie I should have checked your code as Ricardo did my self it is so easy to miss one small mistake. I got to the end of basics and found I did not know how to assign a text color in one quiz. I went back and did not find an answer yet. I have been writing and collecting the rules as Jim teaches them in order to have a reference. My memory is so poor. I still run into the question in one of the first quizzes that asks which of four is that valid for loop and still have not seen what rules I need to actually solve this with confidence.