JS-new 发表于 2018-04-03 | 分类于 学习 JS中并没有类的概念,但是经常性会看到 var test = new Test('duke') 这样的写法。很像java里构造实例的方式。 123456789101112131415161718// ES5function Test(name) { this.name = name}// 等价于function Test(name) { var obj = Object.create(Test.prototype) obj.name = name return obj}// ES6class Test { constructor (name) { this.name = name }}