File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,6 @@ console.log(`The base part of ${filePath} is ${base}`);
1818// Create a variable to store the ext part of the variable
1919
2020const dir = filePath . slice ( 1 , lastSlashIndex ) ;
21- const ext = base . split ( "." ) [ 1 ] ;
21+ const ext = base . slice ( base . lastIndexOf ( "." ) + 1 ) ;
2222
2323// https://www.google.com/search?q=slice+mdn
Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
1111// The num variable will evaluate to a random number between the minimum and maximum values
1212
1313// Math.random()
14- // Random decimal number (0 - 1)
14+ // Random decimal number [0, 1)
1515
1616// (maximum - minimum + 1)
1717// The size of the range
1818
1919// Math.random() * (maximum - minimum + 1)
20- // Random decimal (0 - 100 )
20+ // Random decimal [0, 101 )
2121
2222// Math.floor(...)
23- // Rounds the result down to a whole number (0 - 99)
23+ // Rounds the result down to a whole number [0, 100]
2424
25- // Adding minimum shifts the range up, so the final result is between the minimum and maximum (1 - 100 inclusive)
25+ // Adding minimum shifts the range up, so the final result is between the minimum and maximum [1, 100]
Original file line number Diff line number Diff line change @@ -17,9 +17,9 @@ const pounds = paddedPenceNumberString.substring(
1717) ;
1818
1919// 5. extracts the pence part by taking the last two digits, and pads with trailing zeroes if needed
20- const pence = paddedPenceNumberString
21- . substring ( paddedPenceNumberString . length - 2 )
22- . padEnd ( 2 , "0" ) ;
20+ const pence = paddedPenceNumberString . substring (
21+ paddedPenceNumberString . length - 2
22+ ) ;
2323
2424// 6. formats and prints the result as a pounds and pence string
2525console . log ( `£${ pounds } .${ pence } ` ) ;
You can’t perform that action at this time.
0 commit comments