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 trialvacvvvvvvvvvvvvvv
Java Web Development Techdegree Student 4,597 PointsPlease review my solution. I worked hard to solve the challenge and every problem could happen.
var name, check = 0, info = "";
function stdout(mess){ //write the result on screen
document.getElementById("outputHere").innerHTML = mess;
}
function outputScreen(){ //check if userName is in database, print data out
for (var i = 0; i < students.length; i++){
if (nameInput.toLowerCase() === students[i].name.toLowerCase()){
info +=
"<br /><strong>Student: " + students[i].name + "</strong>" +
"<br />Track: " + students[i].track +
"<br />Archievements: " + students[i].archievements +
"<br />Points: " + students[i].points +
"<br />";
check = 1;
stdout(info);
}
}
}
function request(){
nameInput = prompt("Type the name you want to find info.\nType quit or click Cancel to exit program.");
if (nameInput === "quit" || nameInput === null){
alert("Program was end.");
return;
} else{
info = "";
stdout(info); //reset the output area on web page.
outputScreen();
if (!check){
alert("We don't have this name: " + nameInput);
}
check = 0; //reset this variable for the next typing
request();
}
}
request();
Helmut Granda
10,343 PointsHelmut Granda
10,343 PointsCould you elaborate on what you are trying to get reviewed?