File tree Expand file tree Collapse file tree 2 files changed +45
-11
lines changed Expand file tree Collapse file tree 2 files changed +45
-11
lines changed Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
- var anchor = document . querySelector ( 'a' ) ;
3
- if ( anchor ) {
4
- console . log ( anchor . href ) ;
5
- }
6
- console . log ( anchor . href ) ;
7
- //const form = document.querySelector('form')!;
2
+ // classes
3
+ var Invoice = /** @class */ ( function ( ) {
4
+ function Invoice ( c , d , a ) {
5
+ this . client = c ;
6
+ this . details = d ;
7
+ this . amount = a ;
8
+ }
9
+ Invoice . prototype . format = function ( ) {
10
+ return this . client + " owes \u00A3" + this . amount + " for " + this . details ;
11
+ } ;
12
+ return Invoice ;
13
+ } ( ) ) ;
14
+ var invOne = new Invoice ( 'mario' , 'work on the mario website' , 250 ) ;
15
+ var invTwo = new Invoice ( 'luigi' , 'work on the luigi website' , 300 ) ;
16
+ var invoices = [ ] ;
17
+ invoices . push ( invOne ) ;
18
+ invoices . push ( invTwo ) ;
19
+ // invoices.push({ name: 'shaun' });
20
+ console . log ( invoices ) ;
8
21
var form = document . querySelector ( '.new-item-form' ) ;
9
22
console . log ( form . children ) ;
10
23
// inputs
Original file line number Diff line number Diff line change 1
- const anchor = document . querySelector ( 'a' ) ! ;
2
- if ( anchor ) {
3
- console . log ( anchor . href ) ;
1
+ // classes
2
+ class Invoice {
3
+ client : string ;
4
+ details : string ;
5
+ amount : number ;
6
+
7
+ constructor ( c : string , d : string , a : number ) {
8
+ this . client = c ;
9
+ this . details = d ;
10
+ this . amount = a ;
11
+ }
12
+
13
+ format ( ) {
14
+ return `${ this . client } owes £${ this . amount } for ${ this . details } ` ;
15
+ }
4
16
}
5
- console . log ( anchor . href ) ;
6
17
7
- //const form = document.querySelector('form')!;
18
+ const invOne = new Invoice ( 'mario' , 'work on the mario website' , 250 ) ;
19
+ const invTwo = new Invoice ( 'luigi' , 'work on the luigi website' , 300 ) ;
20
+
21
+ let invoices : Invoice [ ] = [ ] ;
22
+ invoices . push ( invOne )
23
+ invoices . push ( invTwo ) ;
24
+ // invoices.push({ name: 'shaun' });
25
+
26
+ console . log ( invoices ) ;
27
+
28
+
8
29
const form = document . querySelector ( '.new-item-form' ) as HTMLFormElement ;
9
30
console . log ( form . children ) ;
10
31
You can’t perform that action at this time.
0 commit comments