Skip to content

Commit e161bfe

Browse files
committed
Declare and log ext in 3-paths.js
1 parent ac6e7f0 commit e161bfe

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎Sprint-2/1-key-exercises/3-paths.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ console.log(`The base part of ${filePath} is ${base}`);
1919

2020
const dir = filePath.slice(0,lastSlashIndex);
2121
console.log(`The dir parth of ${filePath} is ${dir}`);
22-
//const ext = ;
22+
23+
const lastPeriodIndex = filePath.lastIndexOf(".");
24+
const ext = filePath.slice(lastPeriodIndex);
25+
console.log(`The ext part of ${filePath} is ${ext}`);
2326

2427
// https://www.google.com/search?q=slice+mdn

0 commit comments

Comments
 (0)