JSFiddle - React, Tailwind, and code Playground

by Seetpal Singh

JavaScript

var URI = 'www.example.com/folder/code/12345/',
    parts = URI.split('/'),
    lastPart = parts.pop() == '' ? parts[parts.length - 1] : parts.pop();
alert(lastPart);