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
Joe Sleiman
5,921 Pointsposting problem
i can't post a big code like others do ...it looks like a story all the lines is combined so plz if anyone face such this problem tell me how can i solve it
8 Answers
Kevin Korte
28,149 PointsIf you look at the markdown cheatsheet link below a reply box, it'll explain how to use code, basically you use the backtick button, which is top left of your keyboard.
Joe Sleiman
5,921 Pointsi don't understand ... i have code about 30 lines in javascript when i copy it fron my notepad and past it in the post .... all the lines are combined
Kevin Korte
28,149 PointsGo ahead and post it here and we'll see if we can't untangle it.
Joe Sleiman
5,921 Pointsokay but also i have another problemm with take snapshot doesn't work
Joe Sleiman
5,921 Points//SOLUTION MADE BY ME!!!!
//The Student Record Search Challenge Solution
var message = '';
var response;
var messages = [];
var notExist = '';
var counterNotExist = 0;
var counterName = 0;
var students = [
{ name : 'Joe' , track : 'Front End Development' , achievements : 1090, points : 2970},
{name : 'Margot' , track : 'Web Design' , achievements : 960, points : 2970},
{name : 'Ghinwa' , track : 'iOS' , achievements : 30, points : 3770},
{name : 'Joe' , track : 'Android' , achievements : 500, points : 2550},
{name : 'Chady' , track : 'Game Development' , achievements : 10, points : 1610}
];
function print(message){
var outputDiv = document.getElementById('output');
outputDiv.innerHTML = message;
}
do{
response = prompt("Search student records : type a name[Joe] or type 'quit' to end");
if(response === null){
break;
}
counterNotExist = 0;
for(var i=0;i<students.length;i++){
if(response.toLowerCase() === students[i].name.toLowerCase()){
message += '<h2> Student : ' + students[i].name + '</h2>';
message += '<p> Track : ' + students[i].track + '</p>';
message += '<p> Points : ' + students[i].points + '</p>';
message += '<p> Achievements : ' + students[i].achievements + '</p>';
messages.push(message);
message = '';
}
else{
counterNotExist += 1;
}
}
if(counterNotExist === students.length){
message = '<h2>' + response + ' Not Exist </h2>';
messages.push(message);
}
print(messages);
message = '';
messages = [];
}while(response !== 'quit')
Kevin Korte
28,149 PointsSee how I formatted that, you can hit edit on your post to see.
At the bottom of each reply box there is this: Reference this Markdown Cheatsheet for syntax examples for formatting your post.
When you click the bold markdown cheatsheet, a modal pops up that explains how to format things in the forum.
Joe Sleiman
5,921 Pointssorry can you give the link how can i learn about what you did for my code.... or give me a summary about how can i write the code to be like this i tried but i don't find what you put in the code .... sorry for my english .... i'm lebanese....
Joe Sleiman
5,921 Pointsokay man thanks a lottttttt
Kevin Korte
28,149 PointsNo problem, it's just looks like this
//your code here
Joe Sleiman
5,921 Pointswhat this?
Kevin Korte
28,149 PointsEh, sorry, forgot it would do that. It's backticks.