Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to get the extension from filename using javascript

var ext = fileName.substr(fileName.lastIndexOf('.') + 1);
Comment

JavaScript - How to get the extension of a filename

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

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

file extension name in js

const path = require('path')

path.extname('picture.png') //.png
path.extname('picture.of.a.dog.png') //.png
path.extname('picture.of.a.dog.jpg') //.jpg
path.extname('picture.of.a.dog.jpeg') //.jpeg
Comment

PREVIOUS NEXT
Code Example
Javascript :: store input into array javascript 
Javascript :: how to find id in array javascript 
Javascript :: change navigation animation react native 
Javascript :: js string count 
Javascript :: await in react in function component 
Javascript :: reset form jquery | form reset javascript/jquery 
Javascript :: change value of variable javascript 
Javascript :: counter in javascript 
Javascript :: joi unique validation 
Javascript :: upload preview image jquery 
Javascript :: how to access dictionary keys in js 
Javascript :: javascript compare values of two arrays 
Javascript :: select in react js 
Javascript :: plotly in react 
Javascript :: check upload img extension jquery 
Javascript :: get timezone name from date javascript 
Javascript :: react-native navigation screen props 
Javascript :: if between two numbers javascript 
Javascript :: how to go to another page onclick in react 
Javascript :: .NET number values such as positive and negative infinity cannot be written as valid JSON. 
Javascript :: javascript getcontext 
Javascript :: how to import dotenv in react 
Javascript :: node filesystem change directory of a file 
Javascript :: javascript promise all 
Javascript :: uppercase javascript using function 
Javascript :: angular redirect to external url 
Javascript :: get previous year in javascript 
Javascript :: adding cypress to react project using npm 
Javascript :: linking html with javascript 
Javascript :: rgb javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =