JSFiddle - React, Tailwind, and code Playground

by lun471k

HTML

<p id="originalURI"></p>
<p id="p"></p>

<h2>listing the array down there</h2>
<ul id="list"></ul>

CSS

ul li{font-family:"Courier New"; background-color:#CCC; list-style-type:square}

JavaScript

var chunks = window.location.href.split('/');

document.getElementById("originalURI").innerHTML = window.location.href;

document.getElementById("p").innerHTML = chunks[chunks.length-2];

var ul = document.getElementById('list');
for (var i in chunks)
{
    var p = document.createElement('li');
    var text = document.createTextNode(chunks[i]);
    p.appendChild(text);
    ul.appendChild(p)    
}