Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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 ? :)