Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个网址,例如: http ://www.mysite.com/page/blog/category/postname/
我需要做的是将它从第三个到最后一个'/'拆分,所以它返回:category/postname/
我该怎么做呢????
试试这个:
var last3 = str.split("/").slice(-3).join("/");