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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Graham O Connor](https://secure.gravatar.com/avatar/14f5d5d8443583fad02842f23bfb6be6?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Graham O Connor
6,551 PointsThis code doesn't seem to work
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Students</title> <link rel="stylesheet" href="styles.css"> </head> <body >
<div id = "output"></div> <script src = "student.js"></script> <script src = "studentscript.js"></script>
</body> </html>
var students = [ {
Name: "Dave",
Track: "Front end Development",
Achievements: 300,
Points: 14000
}, {
Name: "Graham",
Track: "IOS Development with swift",
Achievements: 175,
Points: 10000
}, {
Name: "Steven",
Track: "PHP Development",
Achievements: 200,
Points: 900
}, {
Name: "Rachel",
Track: "Android",
Achievements: 450,
Points: 20000
}, {
Name: "George",
Track: "PHP",
Achievements: 450,
Points: 20000
}
];
var message = ""; var student; var search;
function print(message){
document.getElementById("output").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>Achievement: " + student.Achievements + "</p>";
return report;
}
while(true){
search = prompt("Search student records: Type the name [Jody] (or type quit to end)");
if(search === null || search.toLowerCase() === "quit"){
break;
}
for(var i = 0; i <students.length; i++){
student = students[i];
if(student.Name === search){
message = getStudentReport(student);
print(message);
}
}
}
3 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsProper code quoting would help tremendously. See the Markdown Cheatsheet pop-up below the answer section.
But I was able to try your code anyway, and it works very well. Good job!
Now, why do you think it's not working? Did you try to enter names in lower case? Since you don't do any case conversion, it's important to enter the student name with proper capitalization. Or are you having a different problem?
![Nick Ruiz](https://uploads.teamtreehouse.com/production/profile-photos/38341/micro_image.jpg)
Nick Ruiz
18,492 PointsAre you not getting any output in the web browser? If so, I think your issue is with linking your scripts. It should look like this.
<script src="js/students.js"></script>
<script src="js/student_report.js"></script>
students.js and student_report.js are nested inside the js folder directory so without specifying that you probably won't get any output because it cannot find those files.
![Nick Ruiz](https://uploads.teamtreehouse.com/production/profile-photos/38341/micro_image.jpg)
Nick Ruiz
18,492 Pointsalso maybe the way you have your print function setup, not sure. Here's mine
function print(message){
var outputDiv = document.getElementById("output");
outputDiv.innerHTML = message;
}