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

$(function () {
  var here = ["one", "two", "three", "four"];
  var parts = [{
    "text": 'Home',
    "link": '/'
  }];

  for (var i = 0; i < here.length; i++) {
    var part = here[i];
    var text = part.toUpperCase();
    var link = '/' + here.slice(0, i + 1).join('/');
    parts.push({
      "text": text,
      "link": link
    });
  }
  $('.pushres').append(parts);
});