JSFiddle - React, Tailwind, and code Playground
JavaScript
var userProfiles1= new Array(1, "ashok");
var userProfiles2= new Array(2, "amit");
var userProfiles3= new Array(3, "rajeev");
var UArray = new Array(userProfiles1, userProfiles2, userProfiles3);
var questions1= new Array(1, "text1", 2);
var questions2= new Array(2, "text2", 2);
var questions3= new Array(3, "text3", 1);
var questions4= new Array(4, "text4", 2);
var questions5= new Array(5, "text5", 3);
var questions6= new Array(6, "text6", 3);
var QArray = new Array(questions1, questions2, questions3, questions4, questions5, questions6);
var ResultArray = new Array();
for (var i=0; i<UArray.length; i++)
{
var uid = UArray[i][0];
var name = UArray[i][1];
for(var j=0; j<QArray.length; j++)
{
if(uid == QArray[j][2])
{
var qid = QArray[j][0]
var text = QArray[j][1];
ResultArray.push(qid +"," + text +","+ name)
}
}
}
for(var i=0; i<ResultArray.length; i++)
{
document.write(ResultArray[i] + "<br>")
}