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 trialisraelmaykut
8,730 PointsJS Execution
What is the process by which scripts are executed? The reason I ask is because I want to be able to run the scripts I am learning here in other places. For this reason I make sure that everything i do in Treehouse i can also replicate in Cloud 9. This has worked for HTML and CSS but even these first simple commands in JS do not execute. Thank you.
2 Answers
Ryan Field
Courses Plus Student 21,242 PointsAs long as you have JS enabled in your browser, it is constantly tracking what you are doing on the page. Each mouse movement, click, etc. is registered as an 'event' with multiple properties.
That being said, JavaScript can be run a number of different ways. You can define a function and have it run on initial page loading, you can have a piece of code that is continuously running in the background, or you can bind listeners to elements so that code is only executed when certain actions are taken. Some pages use none of these methods, and some use one or more (or even a combination of them).
I'm no JavaScript expert, so I'm sure there are others, but I think that's the gist of what you were wondering.
Seab Jackson
5,692 PointsDid you link the javascript file to your html document?