Answers for "javascript remove file extension"

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 "javascript remove file extension"

Code answers related to "Javascript"

Browse Popular Code Answers by Language