js get file name without extension code example
Example 1: javascript get file extension
var fileName = "myDocument.pdf";
var fileExtension = fileName.split('.').pop(); //"pdf"
Example 2: exclude extension from filename javascript
const file = 'test.jpg';
const filename = file.split('.').slice(0, -1).join('.');
Example 3: node js get file name without extension
filename.split('.').slice(0, -1).join('.')