Using javascript on my site to create nested tabs

A couple of things before I get into the code:

1) It would probably be a cleaner solution to solve this in the theme via extended functionality (PHP modifications) as you gain more experience with WordPress.

2) If you are able to use numbers (1,2,3) instead of words (one,two,three) you can clean up the javascript solution even further.

On with the code!

See the fiddle for a working example: https://jsfiddle.net/2nzcnhwL/

// run after load to be safe
$(document).ready(function () {
    // map our numbers to words
    var subTabGroups = ['one','two','three','four','five'];
    // loop through all of the panes
    $('.mk-tabs-pane').each(function (i) {
        // append each group of subtabs to the corresponding pane
        $(this).append($('.tab' + subTabGroups[i] + 'content'));
    });
});