第一个js库文件
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>js lever</title>
<script type="text/javascript">
var testModult =(function(){
var counter = 0;
return {
incrementCounter:function()
{
return ++counter;
},
resetCounter:function(){
console.log("counter value prior to reset: "+counter);
counter=0;
}
};
})();
testModult.incrementCounter();
testModult.resetCounter();
</script>
</head>
<body>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>js lever</title>
<script type="text/javascript">
var testModult =(function(){
var counter = 0;
return {
incrementCounter:function()
{
return ++counter;
},
resetCounter:function(){
console.log("counter value prior to reset: "+counter);
counter=0;
}
};
})();
testModult.incrementCounter();
testModult.resetCounter();
</script>
</head>
<body>
</body>
</html>