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)
![Christian 123](https://secure.gravatar.com/avatar/71456737447d0ff73970e9c57dcb4d22?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Christian 123
6,899 PointsA mistake? But better :D
I got confused and thought he mean to make different students with different properties so yea i did this xD i could have done what he actualy wanted way easier, check it
var students = [
];
function randomNumber(lowNum, highNum) {
var answer = Math.floor(Math.random() * (highNum - lowNum + 1) + lowNum );
return answer;
}
function randomTrack() {
var track = Math.floor(Math.random() * (3 - 1 + 1) + 1 );
if (track === 3) {
track = 'Front-End development';
} else if (track === 2) {
track = 'Back-End development';
} else {
track = 'Graphic Designer';
}
return track;
}
function nameRandom(howMany) {
var whatName = Math.floor(Math.random() * (howMany - 1 + 1) + 1);
var nameArray = ['Corliss', 'Salina', 'Melissia', 'Shona', 'Edda', 'Taryn', 'Rosalina', 'Honey', 'Francine', 'Robyn'];
whatName = nameArray[whatName];
return whatName;
}
for (i = 0; i < randomNumber(5, 10); i++) {
students.push(
{
name: nameRandom(randomNumber(1, 10)),
track: randomTrack(),
achievements: randomNumber(0, 10),
points: randomNumber(0, 50) + '<br>'
}
)
}
var holder = '';
for (i = 0; i < students.length; i++) {
for (key in students[i]) {
document.write('<b>', key, ': ', students[i][key], '</b>', '<br>');
}
}
Try it out in workshop or whatever text editor you're using and keep refreshing
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsHave fun while you're learning, but remember...
The ability to create a program in the least amount of time that produces the result they want is a skill most admired by employers.
The ability to spend more time to create something that produces a result different than what they want will generally not be well appreciated.
Christian 123
6,899 PointsChristian 123
6,899 PointsYea of course, i just generally didn't understand what he said so i did it my own way :P