Manipulate the URL string

PHOTO EMBED

Thu Sep 22 2022 20:47:23 GMT+0000 (Coordinated Universal Time)

Saved by @zaccamp #javascript

// breaks url string into array
    const id = window.location.toString().split('/') [
        // grab last item in array 
        window.location.toString().split('/').length - 1 
    ];
content_copyCOPY

Ex.) http://localhost:3001/post/1 splits a URL into array at the '/' character, then grabs the 1 as the last item in the array