File tree 4 files changed +1358
-94
lines changed
4 files changed +1358
-94
lines changed Original file line number Diff line number Diff line change 6
6
7
7
export function capitalize ( word ) {
8
8
if ( word === undefined ) throw new Error ( 'word is required' ) ;
9
- // Add your code here!
9
+ const firstLetter = word . charAt ( 0 ) ;
10
+ const upperCaseFirstLetter = firstLetter . toUpperCase ( ) ;
11
+ return upperCaseFirstLetter + word . slice ( 1 ) ;
10
12
}
11
13
12
14
export function generateInitials ( firstName , lastName ) {
13
15
if ( firstName === undefined ) throw new Error ( 'firstName is required' ) ;
14
16
if ( lastName === undefined ) throw new Error ( 'lastName is required' ) ;
15
- // Add your code here!
16
- }
17
+ const firstNameInitial = firstName [ 0 ] ;
18
+ const lastNameInitial = lastName [ 0 ] ;
19
+ return `${ firstNameInitial } .${ lastNameInitial } ` ; }
17
20
18
21
export function addVAT ( originalPrice , vatRate ) {
19
22
if ( originalPrice === undefined )
20
23
throw new Error ( 'originalPrice is requied' ) ;
21
24
if ( vatRate === undefined ) throw new Error ( 'vatRate is required' ) ;
22
- // Add your code here!
25
+ const vatAmount = originalPrice * vatRate ;
26
+ return originalPrice + vatAmount ;
23
27
}
24
28
25
29
export function getSalePrice ( originalPrice , reduction ) {
You can’t perform that action at this time.
0 commit comments