JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<head>    
<script language="javascript" type="text/javascript">
var all_data = new Array(
   new Array("selection1", new Array(
      new Array("choice1", new Array('a', [1, 2, 3, 4]), new Array('b', [3, 4])),
      new Array("choice2", new Array('a', [3, 4]), new Array('b', [1, 4]), new Array('c', [1, 3, 4]))
   )),
   new Array("selection2", new Array(
      new Array("choice3", new Array('a', [2, 4]), new Array('b', [1, 3, 4]), new Array('c', [3, 4])),
      new Array("choice4", new Array('b', [1, 4]), new Array('c', [1, 3])),
      new Array("choice5", new Array('b', [1, 2, 4]), new Array('c', [1, 2, 3, 4]))
   ))
);
function arraySearch(arr, i) {
    var result = [];
    for (var i = 0; i < arr.length; i++) {
        for (var j = 0; j < arr[i].length; j++) {
             for (var k = 0; k < arr[i][j].length; k++) {
                var el = arr[i][j][k];
                if (el instanceof Array) { 
                    //alert(el);
                    //here i want to check if 'i' exists in each 'el'
                    //and if found, concat the element "choice1, choice2..." 
                }
            }
        }
    }
    return result;
}
function getChoices(){
    selected_method = document.form.method.selectedIndex;
    var n = selected_method+1;
    var elements = arraySearch(all_data, n);
    //alert(elements);
}    
</script>
</head>

<body>
<form action="#" method="post" enctype="multipart/form-data" name="form" id="form">
<select name="method" onchange="getChoices();">
   <option selected>opt1</option>
   <option>opt2</option>
   <option>opt3</option>
   <option>opt4</option>
</select>
</form>
</body>
</html>