JS函数表达的几种写法

arguments数组形式的  用于函数  比如不知道参数有多少个或者不固定那么用到arguments
function show(){
//alert(arguments.;length);
alert(arguments[0]);
}
alert(show(12,3,4));//0角标是12
(1)典型的函数声明

function slide(arguments){

//...code/
}
(2)以函数表达式的形式定义函数
var slide = function(arguments){
//...code
}
他们有所区别:例子二是赋值给了一个变量
 
var slide=new Object(){
//...code
}
个人理解 构造函数是为了多个调用 配合this 
例子:
var b=a("我");
console.log(b);
function a(name){
var student=new Object();
student.name=name;
student.sayHi=function(){
console.log(this.name+"说大家好");
}
return  student;
}  
原文地址:https://www.cnblogs.com/hello-web/p/6663742.html