JavaScript program for arrays

 var ary=[

["Harry",18,"Male","B.Com"],

["Sunny",19,"Male","BCA"],

["Sarah",18,"Female","BCA"],

["Tom",17,"Male","BA"],

["Gaurav",17,"Male","BA"],

];

document.write("<table border='2' cellspacing='0'>");

for(var a=0;a<ary.length;a++)

{

    document.write("<tr>");

    for(var b=0;b<ary[a].length;b++)

    {

        document.write("<td>"+ary[a][b]+"</td>");

    }

    document.write("</tr>");

}

document.write("</table>");

Output




Comments