Skip to content

Instantly share code, notes, and snippets.

@Woodsphreaker
Created October 19, 2017 02:06
Show Gist options
  • Save Woodsphreaker/396d80369d416bb1a97a7ba61b05a0a9 to your computer and use it in GitHub Desktop.
Save Woodsphreaker/396d80369d416bb1a97a7ba61b05a0a9 to your computer and use it in GitHub Desktop.
getExtension
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