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 The Landscape of JavaScript JavaScript Tools and Workflows What Build Tools Do JavaScript Developers Use?

What is source code?

This article uses the term "source code" but does not explain what it is.

Source code is the fundamental component of a computer program that is created by a programmer. It can be read and easily understood by a human being. When a programmer types a sequence of statements into a text editor like notepad, for example, and saves the sequence as a text file, the text file is said to contain the source code. Think about it like a map of what you are planning to implement in the actual code.

1 Answer

Steven Parker
Steven Parker
229,745 Points

As already mentioned, "source" code is what you write. In some languages, this gets converted by software known as a compiler into code that the computer can use directly.

But JavaScript is an interpreted language, that means the code is used just as it is. So JavaScript code is always "source code".

JavaScript is not compiled? Surely the computer can't read it as we can?

Jay Thomas
seal-mask
.a{fill-rule:evenodd;}techdegree
Jay Thomas
Full Stack JavaScript Techdegree Student 6,734 Points

https://web.stanford.edu/class/cs98si/slides/overview.html

JavaScript is an interpreted language, not a compiled language. A program such as C++ or Java needs to be compiled before it is run. The source code is passed through a program called a compiler, which translates it into bytecode that the machine understands and can execute. In contrast, JavaScript has no compilation step. Instead, an interpreter in the browser reads over the JavaScript code, interprets each line, and runs it. More modern browsers use a technology known as Just-In-Time (JIT) compilation, which compiles JavaScript to executable bytecode just as it is about to run.