<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
function myNew(constructor,...args){
const obj = Object.create(constructor.prototype)
const result = constructor.apply(obj,args)
return result instanceof Object ? result : obj
}
function Person(name,age){
this.name = name;
this.age = age;
return {text:"欢迎"}
}
const myy = myNew(Person,"苗",24)
console.log(myy);
</script>
</body>
</html>