उदाहरण
split() मेथड का उपयोग करके URL को फॉरवर्ड स्लैश से स्प्लिट करें।
var newURL = "https://www.example.com/index.html/homePage/aboutus/";
console.log(newURL);
var splitURL = newURL.toString().split("/");
console.log(splitURL);
प्रोग्राम चलाने के लिए:
node fileName.js
आउटपुट
PS C:\Users\Amit\JavaScript-code> node demo150.js https://www.example.com/index.html/homePage/aboutus/ [ 'http:', '', 'www.example.com', 'index.html', 'homePage', 'aboutus', '' ]