1.编写程序使用ES6定义 Person类,包括类实例属性(name,age),实例方法say()该方法,返回name和age字符串
class Person{
constructor(name,age){
this.name = name;
this.age = age;
}
say(){
console.log(this.name,this.age);
}
}
2.下面程序执行结果为:
var p=new Person();
console.log(p.__proto__===Person.prototype)
答案:true
3.下面程序正确吗?错在哪里?如何改正?
class Point {
constructor(x, y) {
this.x = x;