let web={name:"houdunern",url:"xxx.com"} let {name,url}=web; console.log(name,url); let web={name:"houdunern",url:"xxx.com"} let {name,url}=web; console.log(name,url);
let arr=["houdunren","xxx.com"]; // let [,b]=arr; let [a,b]=arr; console.log(a,b)
let name="houdunren",url="xxx.com"; let opt={name,url};//这个写法相当于let opt={name:name,url:url}; console.log(opt);
let hd={ name:"houdunren", lesson:{ title:"javascript" } }; let { name, lesson:{title} }=hd; console.log(name,title);
let arr=["houdunren","xxx.com"]; let [a,b,c="hdcms"]=arr; console.log(a,b,c); let arr=["houdunren","xxx.com"]; let [a,b,c="hdcms"]=arr; console.log(a,b,c);
let arr={a:"houdunren",b:"xxx.com",c:"123"}; let {a,b,c="hdcms"}=arr; console.log(a,b,c);
function createElement(options={}){ let {width=200,height=100,backgroundColor='red'}=options; console.log(width,height,backgroundColor); const div= document.createElement('div' ); div.style.width=width+'px'; div.style.height=height+'px'; div.style.backgroundColor=backgroundColor; document.body.appendChild(div); } createElement({width:1000,backgroundColor:'green'});