File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ const spongebob = {
1919 }
2020}
2121
22+ const marcel = {
23+ nama : "Marcel" ,
24+ nama_lengkap : "Marcel Dita Nugraha" ,
25+ sayName : function ( ) {
26+ console . log ( this . nama_lengkap )
27+ } ,
28+ }
29+ marcel . sayName ( )
2230spongebob . sayHello ( )
2331spongebob . sayAgain ( )
2432
Original file line number Diff line number Diff line change @@ -32,4 +32,28 @@ console.log(`The price is: $${product1.calculateTotal(salesTax)}`)
3232product2 . displayProduct ( )
3333console . log ( `The price is: $${ product2 . calculateTotal ( salesTax ) } ` )
3434product3 . displayProduct ( )
35- console . log ( `The price is: $${ product3 . calculateTotal ( salesTax ) } ` )
35+ console . log ( `The price is: $${ product3 . calculateTotal ( salesTax ) } ` )
36+
37+ class dataOrang {
38+ constructor ( nama , alamat , pekerjaan ) {
39+ this . nama = nama ,
40+ this . alamat = alamat ,
41+ this . pekerjaan = pekerjaan
42+ }
43+ tampilkanData ( ) {
44+ console . log ( "=== === === === === ===" )
45+ console . log ( `Namaku adalah: ${ this . nama } ` )
46+ console . log ( `Alamat saya di ${ this . alamat } ` )
47+ console . log ( `Pekerjaan saya adalah ${ this . pekerjaan } ` )
48+ }
49+ }
50+
51+ let doni = new dataOrang (
52+ window . prompt ( "Who are You?" ) ,
53+ window . prompt ( "Where is your address?" ) ,
54+ window . prompt ( "What is your occupation?" )
55+ ) ;
56+ let yanto = new dataOrang ( "Yanto" , "Sambirejo" , "Pelajar SMA" ) ;
57+ let dewi = new dataOrang ( "Dewi" , "Ngetal" , "Pelajar Mahasiswa" ) ;
58+
59+ doni . tampilkanData ( )
You can’t perform that action at this time.
0 commit comments