标签:body console get var rip java func ret utils
<html>
<body>
<script>
//java.utils.ArrayList()
//包(命名空间)
/*
var java = {};
java.utils = {};
java.utils.ArrayList = "asdfafsd";
java.utils.ArrayList;
*/
//
(
function(){
var a = 5;
var b = 100;
window.c = 200;//把c暴露出去
d = 300;//这行代码也可以做到公布
}
)();
//console.log(c);
var result = (function(m,n){
return m + n;})(10,20);
//console.log(result);
function Person(){
var age = 1;
this.getAge = function(){
return age ;
}
this.setAge = function(val){
age = val;
}
}
var p = new Person();
p.setAge(20);
console.log(p.getAge());
//Closure 闭包
</script>
</body>
</html>
标签:body console get var rip java func ret utils
原文地址:http://www.cnblogs.com/luowenjun-kio/p/7900013.html