详解es6 class语法糖中constructor方法和super的做用

首先,ES6 的 class 属于一种“语法糖”,因此只是写法更加优雅,更加像面对对象的编程,其思想和 ES5 是一致的。编程 function Point(x, y) { this.x = x; this.y = y; } Point.prototype.toString = function() { return '(' + this.x + ',' + this.y + ')'
相关文章
相关标签/搜索