js json anonymous function

<script type="text/javascript">

var My_func = function(name){

 
this.obj_name=name;
 
this.func1=function(id){
alert(id);
alert(this.obj_name);
}
}
 
var My_ajax = {
"name":"kevin!",
"debug":function(tel){
alert(tel);
}
};
</script>

<script type="text/javascript">
    var validate = new My_func('kevin');
    validate.func1('20091121149');
    alert(My_ajax.name);
    My_ajax.debug('15125843480')
//    alert('JSON: name'+ My_ajax.name +' gebug:'+My_ajax.debug());
</script>

Reproduced in: https: //www.cnblogs.com/guolanzhu/p/3482336.html

Guess you like

Origin blog.csdn.net/weixin_33920401/article/details/94192905