<!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>
</body>
</html>
<script>
let obj={
name:'张三',
age:18,
gender:'男'
}
console.log(Object.keys(obj));//返回值是个数组
console.log(Object.values(obj));
let obj2={}//obj2要是一个对象
Object.assign(obj2, obj)
console.log(obj2);
//assign实现追加属性
Object.assign(obj,{weight:"100kg"})
console.log(obj);
</script>


被折叠的 条评论
为什么被折叠?



