new object的obj对象得到啥
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>object</title>
</head>
<body>
<script>
var obj={}
obj.a=1;
var newObj=new Object(obj)
console.log(newObj===obj)//true
//引用值 ->object.prototype
</script>
</body>
</html>
new object的数组得到啥
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>object</title>
</head>
<body>
<script>
// var obj={}
// obj.a=1;
// var newObj=new Object(obj)
// console.log(newObj===obj)//true
//引用值 ->object.prototype
var arr=[1,2,3,4]
var newArr=new Object(arr)
console.log(newObj===obj)//true
</script>
</body>
</html>
new arr+数组
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>object</title>
</head>
<body>
<script>
// var obj={}
// obj.a=1;
// var newObj=new Object(obj)
// console.log(newObj===obj)//true
//引用值 ->object.prototype
var arr=[1,2,3,4]
var newArr=new Array(arr)
console.log(newObj===obj)//false
</script>
</body>
</html>
原始值不能添加属性
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>object</title>
</head>
<body>
<script>
// var obj={}
// obj.a=1;
// var newObj=new Object(obj)
// console.log(newObj===obj)//true
//引用值 ->object.prototype
// var arr=[1,2,3,4]
// var newArr=new Array(arr)
// console.log(newObj===obj)//false
//基本值
var a=1
a.b=2;
console.log(a.b)
</script>
</body>
</html>