How to intercept the back address from the third to the last?

I want to get the content "/ product/detail/10552" that begins with the third-to-last slash of str. How should I get it?

"http://1.2.3.4/aaa/product/detail/10552"
"https://aaa.bbb/product/detail/10552"
"http://aaa.bbb.ccc.net/product/detail/10552"
Nov.25,2021

function method(s){

return s.split("/").slice("-3").join("/")

}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b4479e-2c70a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b4479e-2c70a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?