es6解构赋值
<script type="text/javascript"> let obj = {username:'java1234',pwd:'123456'}; /* let username=obj.username; let pwd=obj.pwd;*/ let{username,pwd} = obj; console.log(username,pwd); function func({username,pwd}){ console.log(username,pwd); } func(obj); let arr=[1,4,2,'ccc',false,'啦啦啦']; let[,,,a,b]=arr; console.log(a,b); </script>