Skip to content

Commit 012c2b8

Browse files
committed
✨ Add challenge-11 solution
1 parent d13ee4f commit 012c2b8

File tree

1 file changed

+3
-1
lines changed
  • 2024/11-nombres-de-archivos-codificados

1 file changed

+3
-1
lines changed

2024/11-nombres-de-archivos-codificados/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,15 @@ Luego, obtengo el índice del último punto `.` con el método `lastIndexOf()`:
7272

7373
```js
7474
// const lastDotIndex = '2023122512345678_sleighDesign.png.grinchwa'.lastIndexOf('.');
75-
const lastDotIndex = filename.lastIndexOf('.'); // 29
75+
const lastDotIndex = filename.lastIndexOf('.'); // 33
7676
```
7777

7878
Finalmente, utilizo el método `slice()` para extraer la parte del string que necesitamos:
7979

8080
```js
8181
// return '2023122512345678_sleighDesign.png.grinchwa'.slice(underscoreIndex + 1, lastDotIndex);
82+
// return '2023122512345678_sleighDesign.png.grinchwa'.slice(16 + 1, 33);
83+
// return '2023122512345678_sleighDesign.png.grinchwa'.slice(17, 33);
8284
return filename.slice(underscoreIndex + 1, lastDotIndex); // "sleighDesign.png"
8385
```
8486

0 commit comments

Comments
 (0)