Currently, I am working on the following URL: demo.example.in/posts/0ewsd/13213
My goal is to extract the hostname (demo.example.in) and the path (posts/0ewsd/13213) from this URL.
urlHost = 'demo.example.in/posts/0ewsd/13213';
let urlHostName = urlHost.split("/");
Even after using the split() method, the entire URL gets split into different parts...
['demo.example.in', 'posts', '0ewsd', '13213']
What I actually want is to separate demo.example.in and posts/0ewsd/13213. Is there any alternative approach that can help achieve this?