hasOwnProperty和in属性操作
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
/* 基本使用 */
function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.showName = function() {
console.log("姓名:" + this.name);
}
var p = new Person();
/* in关键字 :for..in循环遍历对象 + 检查对象中是否存在的属性 */
/* in 检查属性 (实例成员 && 原型成员) */
var o = {
address: "北京",
className: "H5"
};
console.log("addre