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 fileIn 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
- <!doctype html>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <script>
- console.log("javascript is working");
- </script>
- </body>
- </html>
Embed JavaScript file
HTML document
- <!doctype html>
- <html lang="en">
- <head>
- </head>
- <body>
- <h1>Testing JavaScript</h1>
- <p>Open Web Browser's developer tools Console window and reload this page.</p>
- <script src="code.js"></script>
- </body>
- </html>
code.js document
- alert("Hi world");
References
https://www.webtoolkitonline.com/javascript-tester.htmlhttps://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)