Jesse DispotoFront End Web Development Techdegree Graduate 14,537 Points
Can someone critique my code, please?
First time doing this snapshot thing.... not sure if this is the correct way to do it?
Anyhow, could someone critique my code? Just want to get criticism on it. I did not open up Dave's solution yet, but my code does what the challenge required.
Somewhat unrelated... is there a way to directly post the snapshot on here instead of putting the link? I've seen others posts' that just directly show the code, and do not provide a link
I took a look at your code (and tried running), and I think you did a great job!
The array of objects (students) looks good. And your logic for using a for loop for both the number of students, and each item in the student object makes a lot of sense.
I was trying to think of some constructive things to help you, and could really only find two small things. Neither of which are huge, but rather suggestions.
1) The first thing I noticed is that there's a div in the HTML with the ID of "output." My assumption is that that's where Dave was looking for you to place the output of your code into the DOM. You could make a small change like this:
document.getElementById('output').innerHTML = html;
2) When reading over the second for loop: for (let student in students[I]), it was a bit confusing at first because of the variable name "student" that was used. When really you're looping over each key, or stat. Maybe renaming that variable something like "studentStat" or "studentInfo" would make it a bit easier for someone else to read:
for (let studentInfo in students[i])
Otherwise great work, for real!