<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> console.log("script第一个位置") </script> </head> <body> <script type="text/javascript"> console.log("script第二个位置") </script> <script src="index.js" type="text/javascript" charset="utf-8"></script> </body> </html>
(function(){ /* * 1.功能模块 */ var util = { printf:function(){ console.log("初始化功能函数") } } /* * 2.逻辑函数,调度功能 */ var logic = { init:function(){ util.printf(); } } /* * begin */ logic.init(); })()