function foo() { var x = ‘Hello, ‘ + y; console.log(x); var y = ‘siry‘; } foo();
function f(){ return [1,2] } let a,b; [a,b]=f();//a=1,b=2 function f1(){ return [1,2,3,4,5] } let a,b; [a,b]=f();//a=1,b=2 [a,,...b]=f1();//a=1;b=[2,3,4,5]
原文:https://www.cnblogs.com/fuGuy/p/9215944.html