Repository navigation
Expand file tree
/
Copy path08-object.html
More file actions
84 lines (71 loc) · 2.33 KB
/
Copy path08-object.html
File metadata and controls
84 lines (71 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html>
<head>
<title>Functions</title>
</head>
<body>
<script>
// const product = {
// name: 'socks',
// price: 1090
// };
// console.log(product);
// console.log(product.name);
// console.log(product.price);
// prodcut.name = 'cotton socks';
// console.log(product);
// product.newProperty = true;
// delete product.newProperty;
// const product2 = {
// name: 'short',
// 'delivvery_time': '1 day',
// rating: {
// star: 4.5,
// count: 87
// }
// };
// console.log(product2);
// consple.log(product2.name);
// console.log(product2['name']);
// console.log(product2['delivvery_time']);
// console.log(JSON.stringify(product2));
// JSON.parse(JSON.stringify(product2));
// const JsonString = JSON.parse(JSON.stringify(product2));
// console.log(JSON.parse(JsonString));
console.log('hello'.length);
console.log('hello'.toUpperCase());
const object1 = {
message: 'hello',
};
const object2 = object1;
object1.message = 'Good job!';
console.log(objects1);
cosole.log(object2);
const object3 = {
message: 'Good job'
};
console.log(object1 === object3); //false
console.log(object2 === object1); //true
const object4 = {
message: 'Good job',
price: 799
};
//const message = object4.message;
const {message, price} = object4;
console.log(message);
console.log(price);
const object5 = {
//message: message
message,
// method: function function1(){
// console.log('method');
// }
method(){
console.log('method');
}
};
console.log(object5);
object5.method();
</script>
</body>
</html>