Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

JavaScript - How to get the extension of a filename

let filename = "index.js";
let extension = filename.split(".").pop();

console.log(extension); // "js"
Comment

how to check the extension of a file in javascript

return filename.split('.').pop();
Comment

how to get file extension in javascript

var fileName = "myDocument.pdf";
var fileExtension = fileName.split('.').pop(); //"pdf"
Comment

PREVIOUS NEXT
Code Example
Javascript :: Program for factorial of a number in javascript 
Javascript :: Reading Time with jquery 
Javascript :: js cound how many clicks 
Javascript :: javascript add listeners to class 
Javascript :: reverse 179 in javascript 
Javascript :: send mail with javascript 
Javascript :: css and js on flask 
Javascript :: javascript element read attribute 
Javascript :: Use History React Router v5 app 
Javascript :: gulp synchronous tasks 
Javascript :: delete cookies by domain javascript 
Javascript :: moment timezone get timezone offset 
Javascript :: regex one or more words 
Javascript :: current date minus days javascript 
Javascript :: 3 = signs in javasdcript 
Javascript :: jquery ajax 500 error handling 
Javascript :: split string in angular 8 
Javascript :: how to handle all error of all router in express 
Javascript :: js copy span text to clipboard 
Javascript :: .call javascript 
Javascript :: push characters to a string javascript 
Javascript :: pyspark json multiline 
Javascript :: REACT-ICONS reduce thickness 
Javascript :: part of sting js 
Javascript :: reverse every word 
Javascript :: js input type range get value on select 
Javascript :: count a character in a string, js 
Javascript :: is check objet empty 
Javascript :: create svg element javascript 
Javascript :: getting all the selected text from multiselect and joing them. 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =