with在js中的用法

来源:互联网 发布:it项目考核管理办法 编辑:程序博客网 时间:2024/05/16 05:23

function obj(){

  this.name="li";

  this.age="24";

 this.favorite="chi"

}

var li=new obj();

with(对象){

  console.log(name);

console.log(age)

//针对对象内成员进行操作

}

0 0
原创粉丝点击