js构造函数怎么写

js构造函数怎么写

由于js类的定义方法和函数的定义方法一样,所以定义类的同时就定义了构造方法。function Person(name,sex){类,同时定义构造方法 this.eat=function(){类中的方法 alert("
JavaScript160