Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThomas Katalenas
11,033 PointsAccess whole list.A nested for loop
Running into performance problems I think... is interesting. why is it only going so fast?
My nested for loop indexes over the entire list. How would artificial intelligence be able to do this working with matrixies would be tough inside a nested for loop every time.
you would have to update the parameters of the matrix. Something matlab, and octave, and sci.py do well. The language Julia(I wish that was taught here) is as fast a C and it uses matrix operators.
var playList = [
['I Did It My Way', 'Frank Sinatra','2p','4'],
['Respect', 'Aretha Franklin','2','5'],
['Imagine', 'John Lennon','6','7'],
['Born to Run', 'Bruce Springsteen','8','9'],
['Louie Louie', 'The Kingsmen',11,77],
['Maybellene', 'Chuck Berry',77,66]
];
function print(message) {
document.write(message);
}
function printSongs( songs ) {
var listHTML = '<ol>';
var j = 0;
for ( var i = 0; i < songs.length; i += 1) {
//listHTML += '<li>' + songs[i][j] + '</li>';
for ( j = 0; j < songs[i].length; j += 1){
listHTML += '<li>' + songs[i][j] + '</li>';
}
}
listHTML += '</ol>';
print(listHTML);
}
printSongs(playList);
Chyno Deluxe
16,936 PointsChyno Deluxe
16,936 PointsI'm not sure what you are asking about. Can you explain your question or what you specifically need help with?