JSFiddle - React, Tailwind, and code Playground

by littlechad

JavaScript

const key = "development/challenge/video/59e0aeb51c7078f59f267418/2017-10-19/910bb2d78f8973a902f5c615633a85911508410470857.mp4"
const test = decodeURIComponent(key.replace(/\+/g, " "))

const newSplitKey = key.split('.')[0]
const newArrKey = newSplitKey.split('/')
const newName = key.split('/').pop().split('.')[0]

newArrKey.splice(-1,1);

const newKey = newArrKey.join('/'); 

console.log(newKey)
console.log(newName)