Saturday, January 26, 2019

How to run JavaScript source files?

First method, use JavaScript online editor


You can go to CodePen (https://codepen.io/) 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>
  7.  
  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");

References

https://www.webtoolkitonline.com/javascript-tester.html
https://js.do/
https://jsfiddle.net/

Resources

Hackr.io (Find & share the best online programming courses & tutorials)
Free Code Camp (www.freecodecamp.com)
Team Treehouse (www.teamtreehouse.com)
Codewars (codewars.com)
iLoveCoding Javascript Screencasts (https://ilovecoding.org)
Codementor(https://www.codementor.io/javasc...)
CodeCloud (CodeCloud.me)
Codecademy (http://www.codecademy.com/#!/exe...)
Lynda (http://www.lynda.com/JavaScript-...)
Channel9 (http://channel9.msdn.com/Series/...)
TheCodePlayer (Learn HTML5, CSS3, Javascript)
Eloquent Javascript Book (http://eloquentjavascript.net/co...)0
Javascript by Douglas Crockford (Douglas Crockford's Javascript)
CodinGame (http://www.codingame)
Mozilla (https://developer.mozilla.org/en...)
Udacity (JavaScript Basics for Beginners Course)
Egg Head (egghead.io - Learn professional JavaScript tools with Tutorial Videos & Training)
CodeSchool: Start with Free Courses at CodeSchool
Pluralsight: (JavaScript)

No comments:

Post a Comment