Created
October 19, 2017 02:06
-
-
Save Woodsphreaker/396d80369d416bb1a97a7ba61b05a0a9 to your computer and use it in GitHub Desktop.
getExtension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fileNames = { | |
file1: "file.doc", | |
file2: "file.xls", | |
file3: "file.jpeg" | |
} | |
const getExtension = file => file.slice(file.lastIndexOf('.') + 1) | |
[...Object.values(fileNames)] | |
.map(el => getExtension(el)) //["doc", "xls", "jpeg"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment