scriptタグの定義順序には意味がある
javascriptの基礎の基礎から勉強中、 下記index.htmlをブラウザでみると boo,boo,uooの順でalertが実行される。
├─public │ │ index.html │ │ │ └─js │ boo.js │ foo.js
boo.js
alert ('boo');
foo.js
alert ('foo');
index.html
<!DOCTYPE html> <html> <head> <title>Welcome to the Mojolicious real-time web framework!</title> <script type="text/javascript" src="js/boo.js"></script> <script type="text/javascript" src="js/foo.js"></script> </head> <body> <h2>Welcome to the Mojolicious real-time web framework!</h2> This is the static document "public/index.html", <a href="/">click here</a> to get back to the start. <script type="text/javascript"> alert("uoo"); </script> </body> </html>
順番には意味があるから、Backbone.jsを使うとき、backbone.jsの前にunderscore.jsが記述されていないとエラーになって、石につまずいた。