You don't have to be online to run JavaScript. JavaScript is a client-side language, meaning it runs in your web browser. Since you're at the JavaScript stage, I'm going to assume you know at least the basics of HTML and hopefully CSS.
You can include a JavaScript file in your HTML document by placing this tag in the section.
<html>
<head>
<script src="/path/relavite/to/htmlpage/your.js"></script>
</head>
...
</html>
Then, you can either open your browser, then File > Open your html page, which now has the JavaScript linked to it, or you can right click the .html file in your file browser, and Open With > Chrome, FireFox, etc. to view the page locally.
Again, a connection to the web is not needed to run these files, since they are stored locally on your computer.
EDIT
Might as well include the file structure. It may be easier to visualize that way.
Locally on your computer, you create a folder named "myjavascripttest". Inside this folder, you create three files: index.html, style.css and script.js
The content of the HTML file is:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="/path/relavite/to/htmlpage/your.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<p>This is a paragraph</p>
</body>
</html>
The content of the CSS file is:
p {
background-color: blue;
}
The content of the JavaScript file is: (Note: this is jQuery, an extension of JavaScript)
$(document).ready(function() {
$(this).css('background-color', 'red');
});
Now, loading the HTML file in your browser will display a paragraph with a red background, though clearly the CSS says it should be blue. The JavaScript thus must be running!