Created
June 19, 2023 12:45
-
-
Save ValchanOficial/8df01b193c4bff31512e86773fe045e6 to your computer and use it in GitHub Desktop.
[Javascript] Get image name from url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = 'https://valchan.com.br/static/59fef712836ff3c9af18106e6daea978/3554d/valchan.webp' | |
const imageName = url.split('/').pop().split('.').shift() | |
const imageName2 = url.split('/').pop().replace(/\.[^/.]+$/, "") | |
console.log(imageName) // valchan | |
console.log(imageName2) // valchan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment