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 JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

JS 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
PLUS
Ryan Field
Courses Plus Student 21,241 Points

As 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.

Did you link the javascript file to your html document?