javascript get file extension from string
var ext = fileName.split('.').pop();var ext = fileName.substr(fileName.lastIndexOf('.') + 1);// Use the lastIndexOf method to find the last period in the string, and get the part of the string after that:
var ext = fileName.substr(fileName.lastIndexOf('.') + 1);
var fileName = "myDocument.pdf";
var fileExtension = fileName.split('.').pop(); //"pdf"
Also in JavaScript:
- target all element besides the clicked one
- after changing the state clearing input feild
- datatables clear table
- jest object containing
- javascript write to file
- getting the value of pi in javascript
- remove array elements javascript
- axios response return html not json data
- setinterval javascript
- how run dockerfile
- clean up android build react native
- 3 = signs in javasdcript
- foreach key value javascript
- how to get value of button that click on it jquery
- rxjs mapto vs tap
- javascript date get day of week abbreviation
- launch.json vscode electron
- js test if string
- oncheck checkbox javascript
- get input value on keypress jquery
- ionic react use yarn
- convert data into json format in javascript
- js yesterday date
- immutable values