Code to go logo
Created using Figma
Use Cases
Contribute
How to get file name from path in JavaScript
Strings
By Jad Joubran ·
Last updated Dec 26, 2018
const url = "/Users/code/codetogo/index.html"; url.substring(url.lastIndexOf("/") + 1);
index.html
Dec 26, 2018
1
Jad Joubran
See answer
1
Jad Joubran
String.lastIndexOf
on MDN
Learn JavaScript step by step
Related use cases
How to get path from full path in JavaScript