SOURCE

function Person(name){
    if(new.target !==undefined){
        this.name = name
    }else{
        throw new Error('必须使用new')
    }
}
// 另一种写法
function Person(name) {
  if (new.target === Person) {
    this.name = name;
  } else {
    throw new Error('必须使用 new 命令生成实例');
  }
}

var notAPerson = Person.call(person, '张三');  // 报错
console 命令行工具 X clear

                    
>
console