javascript - How do I execute .js files locally in my browser? -


hello wondering how can type javascript game on textmate mac , have regular .js file take .js file , open , have run in chrome if have "hello world!" hello world! show in chrome.

an example of i'm after in video: http://vimeo.com/105955605

around 1:51 in video, notice how puts <script> tag in there? way works this:

create html file (that's text file .html ending) somewhere on computer. in same folder put index.html, put javascript file (that's textfile .js ending - let's call game.js). then, in index.html file, put html includes script tag game.js, mary did in video. index.html should this:

<html>     <head>         <script src="game.js"></script>     </head> </html> 

now, double click on file in finder, , should open in browser. open console see output of javascript code, hit command-alt-j (those 3 buttons @ same time).

good luck on journey, hope it's fun has been me far :)


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -