Answers for "js remove extension from filename"

2

exclude extension from filename javascript

const file = 'test.jpg';
const filename = file.split('.').slice(0, -1).join('.');
Posted by: Guest on June-22-2020
1

javascript remove extension from filename

// using string methods only
filename.substring(0, filename.lastIndexOf('.')) || filename

// using both string & array methods
filename.split('.').slice(0, -1).join('.')
Posted by: Guest on October-02-2021

Code answers related to "js remove extension from filename"

Code answers related to "Javascript"

Browse Popular Code Answers by Language