Saturday, January 26, 2019

How to run JavaScript source files?

First method, use JavaScript online editor

You can go to CodePen ( and in the JavaScript window you can paste the code and experiment.

Second method, running JavaScript code from a HTML document

Make a HTML file and embed JavaScript Code

Make a JavaScript file. Put your JavaScript code in this file
In the HTML file, include script tag and refer to the JavaScript file you have created.
Run the html file in any browser.

Inline JavaScript file

HTML document
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title></title>
  5. </head>
  6. <body>
  8. <script>
  9. console.log("javascript is working");
  10. </script>
  11. </body>
  12. </html>

Embed JavaScript file

HTML document
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. </head>
  5. <body>
  6. <h1>Testing JavaScript</h1>
  7. <p>Open Web Browser's developer tools Console window and reload this page.</p>
  8. <script src="code.js"></script>
  9. </body>
  10. </html>

code.js document

  1. alert("Hi world");


Resources (Find & share the best online programming courses & tutorials)
Free Code Camp (
Team Treehouse (
Codewars (
iLoveCoding Javascript Screencasts (
CodeCloud (
Codecademy (!/exe...)
Lynda (
Channel9 (
TheCodePlayer (Learn HTML5, CSS3, Javascript)
Eloquent Javascript Book (
Javascript by Douglas Crockford (Douglas Crockford's Javascript)
CodinGame (http://www.codingame)
Mozilla (
Udacity (JavaScript Basics for Beginners Course)
Egg Head ( - Learn professional JavaScript tools with Tutorial Videos & Training)
CodeSchool: Start with Free Courses at CodeSchool
Pluralsight: (JavaScript)

1 comment: