Ask coding questions

← Back to all posts
JS Assignment 10: Array Properties and Methods
skudeva (18)

Hi everyone,

I am completely lost! I can't figure out exercise 1.

https://repl.it/student/submissions/6952500

function exerciseOne(classmates){
// Exercise One: You will be given an array called 'classmates'
// Create a variable called 'howManyStudents', and assign it to
// the length of the classmates array (using the length property)

var howManyStudents=(classmates);
classmates.lenght;
consol.log(classmates.lenght);

Answered by heyitsmarcus (287) [earned 5 cycles]
View Answer
Commentshotnewtop
heyitsmarcus (287)

Hey @skudeva,

We meet again! haha You are so close with what you have. What you want to do is assign the value of classmates.length to howManyStudents and you can do that on the line with var howManyStudents like this:

function exerciseOne(classmates){
    // Exercise One: You will be given an array called 'classmates'
    // Create a variable called 'howManyStudents', and assign it to
    // the length of the classmates array (using the length property)

    var howManyStudents = classmates.length;
    console.log(howManyStudents);
}

Now, the variable howManyStudents will contain the number of elements in the classmates array passed into the function exerciseOne!

If this answer solved your problem, please consider upvoting and choosing my answer as the accepted answer.

skudeva (18)

@heyitsmarcus I really appreciate your help! Thanks again :D!

heyitsmarcus (287)

@skudeva No worries! Happy Coding! :)

JwalyaOza (3)

@heyitsmarcus. Sir very ashamed to admit but i am really having a hard time in completing the js assignment 10 and i need proper guidance from you in order to finish the assignment as quick as possible and move on to the next one. i could solve the first exercise but ain't able solve the remaining ones and i have been stuck on this from last 4 days so it will be good if you help me

heyitsmarcus (287)

@JwalyaOza I am afraid I don't know this exercise. Copy and paste what code you have and what the problem is, and I can help you better!

JwalyaOza (3)

@heyitsmarcus. Well sir exercise 2 and 3 are the one where I am not able find the correct answer and sorry sir for being very late I was engaged at some other important study related stuff but now I am back and yes. If you will help me to sort out this problem of me being stuck at exercise 2 and 3 of 10th assignment of JavaScript them I would be very thankful to you sir so I hope you can help me

JwalyaOza (3)

@heyitsmarcus. Well sir exercise 2 and 3 are the one where I am not able find the correct answer and sorry sir for being very late I was engaged at some other important study related stuff but now I am back and yes. If you will help me to sort out this problem of me being stuck at exercise 2 and 3 of 10th assignment of JavaScript them I would be very thankful to you sir so I hope you can help me

heyitsmarcus (287)

@JwalyaOza You will have to copy and paste the problem and then copy and paste your code to each problem.

mthotchkiss18 (0)

thank you this helped me also I have been stuck on that one had a long dramatic solution lol was wrong thank you this help out tons now it makes sense to me

janetsomehow1 (2)

@mthotchkiss18 this helped too but in another exercise I have tried adding number to an array but it doesnt seem to work

Kevinw980 (0)

@janetsomehow1 I'm having the same issue on that question, if you've found out the answer please let me know!

MIAlien (0)

@Kevinw980 You have to remove ' '
Numbers do not need this. That is used for letters only. I got the answer correct. Let me know.

numbers.unshift(1);