File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -69,4 +69,35 @@ function product(a, b = 1) {
69
69
return a * b ;
70
70
}
71
71
72
- console . log ( `Product of 5 and 2: ${ product ( 5 , 2 ) } ` ) ;
72
+ console . log ( `Product of 5 and 2: ${ product ( 5 , 2 ) } ` ) ;
73
+
74
+ console . log ( "-------------------------------------------------" ) ;
75
+ console . log ( "Activity 5: " ) ;
76
+
77
+ // Task 8: Use enhanced object literals to create an object with methods and properties, and log the object to the console.
78
+
79
+ let person = {
80
+ name : "Linus" ,
81
+ age : 30 ,
82
+ greet ( ) {
83
+ console . log ( `Hello, my name is ${ this . name } and I am ${ this . age } years old.` ) ;
84
+ }
85
+ } ;
86
+
87
+ person . greet ( ) ;
88
+
89
+ // Task 9: Create an object with computed property names based on variables and log the object to the console.
90
+
91
+ const prop1 = "firstName" ;
92
+ const prop2 = "lastName" ;
93
+ const prop3 = "age" ;
94
+
95
+ // Create an object with computed property names
96
+ const details = {
97
+ [ prop1 ] : "John" ,
98
+ [ prop2 ] : "Doe" ,
99
+ [ prop3 ] : 30
100
+ } ;
101
+
102
+ // Log the object to the console
103
+ console . log ( details ) ;
You can’t perform that action at this time.
0 commit comments