I have data like this:
var array = ["a", "b", "c", "d", "e"];
I want this data converted like this:
<ol>
<li>a</li>
<ol>
<li>b</li>
<ol>
<li>c</li>
<ol>
<li>d</li>
</ol>
</ol>
</ol>
I will try this:
var makeNestedList = () => {
$.each(array, function(i, el) {
nested += '<ol>';
nested += '<li>' + el + '</li>';
makeNestedList();
nested += '</ol>';
});
};
But why is the result empty?
<ol> <li> <ol> <li></li> </ol> </li> </ol>?<ol>should not directly contain another<ol>?!