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 trial


Zaid Anki
.a{fill-rule:evenodd;}techdegree seal-36
Zaid Anki
Full Stack JavaScript Techdegree Graduate 14,514 Points

Completing the Challenges + adding a "list" command as well! unit 1 Array Course!

This is how i did it!, i did not use anything outside of the video except for 1 new variable (and a couple of copy pastes) for the list command!

var message = '';
var student;
var search;
var stunm = [];

function print(message) {
  var outputDiv = document.getElementById('output');
  outputDiv.innerHTML = message;

function getStudentReport (student){
  var report = '<h2>Student: ' + student.name + '</h2>';
  report += '<p>Track: ' + student.track + '</p>';
  report += '<p>Points: ' + student.points + '</p>';
  report += '<p>Achievements: ' + student.achievements + '</p>'; 
  return report
  for (var i = 0; i < students.length; i += 1) {
  student = students[i];

while (true) {
 search = prompt('search student records: type a name [Jody] (type "quit" to end or "list" to see a list of students )');
if (search === null || search.toLowerCase() === 'quit') {
  for (var i = 0; i < students.length; i += 1) {
  student = students[i];
  if (student.name === search) {
    message += getStudentReport( student );

  if (search.toLowerCase() === 'list') {
   alert(stunm.join(', ')) 
  }else if (stunm.indexOf(search) < 0){
  alert('there is no student with that name');


1 Answer

Mino Karadzhov
Mino Karadzhov
8,167 Points

Hello, Zaid ! I think this is a great solution ! Are you experiencing any problems with your code, due to which you are reaching the community ? :)