i have this loop.
now, in a[i] im putting name of college, for example UCLA.
in temp i have the name of the player i want to insert into the a[i][p]
When im looking at temp im seeing the name that i actualy wants to insert, but them im
doing this line a[i][p] = temp;
im seeing in a[0][0]='U',
why?
var a = [[]];
var p = 0;
var temp;
for (var i = 0; i < uniq.length; i++) {
a[i] = uniq[i];
for (var k = 0; k < data.players.length; k++) {
if (uniq[i] == data.players[k].college)
{
temp = data.players[k].name
a[i][p] = temp;
p++;
}
}
p = 0;
}
console.log(a[0][0])

a[0][0]you are accessing the first element of the first element of a. a is in fact an array, so witha[0]you are accessing the first array value of a. In your case this is a string (not an array!). So witha[0][0]you get the first value of the string, which happens to be a 'U'.