JSFiddle - React, Tailwind, and code Playground
by Kelly Hawker
HTML
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<div class="pushres"></div>
JavaScript
$(document).ready(function() {
var xx = ["1", "2", "3", "4"];
var parts = [{ "text": 'Home', "link": '/' }];
for( var i = 0; i < xx.length; i++ ) {
var part = xx[i];
var text = part.toUpperCase();
var link = '/' + xx.slice( 0, i + 1 ).join('/');
parts.push({ "text": text, "link": link });
}
$()
});