1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <script>
- var obj1 = {
- name:"LiLi",
- age: 10,
- happy:"哈哈哈哈"
- }
- var obj2 = {
- name:"Lucy",
- age: 20
- }
- let arr = [ "11","22"]
- console.log([
- {
- aa:"111"
- }
- ])
- // 1.Object.is() 判断传入的值 是否 全等
- // console.log(Object.is("LILI","LILi"));
- // 2.Object.assign() 参数二会覆盖参数一的相同属性 不同则合并
- // console.log(Object.assign(obj1,obj2))
- // 3.Object.setPrototypeOf(对象,对象类型) 设置对象原型类型
- let newObj = Object.setPrototypeOf(
- obj2,arr
- );
- console.log(newObj);
- // 4.Object.setPrototypeOf 获取对象原型类型
- console.log(Object.getPrototypeOf(newObj))
- // 5.Object.keys 获取当前对象可枚举的属性名键值
- console.log(Object.keys(obj2))
- // 6.Object.values 获取当前对象可枚举的属性值键值
- console.log(Object.values(obj2))
- // 7.Object.entries 获取当前对象可枚举的键值
- console.log(Object.entries(obj2))
- </script>
- </body>
- </html>
|