Ask coding questions

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

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 (280) [earned 5 cycles]
View Answer
Commentshotnewtop
4
heyitsmarcus (280)

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.

1
skudeva (8)

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

1
heyitsmarcus (280)

@skudeva No worries! Happy Coding! :)

1
JwalyaOza (3)

@skudeva. buddy i'm feeling really very ashamed to let you know that ONCE AGAIN i'm facing some extremely silly yet complicated quarries in solving the js assignment 10 please it's my humble request to you to find me the correct way of typing the answers. though i forgot to tell you that i Actually got able to get what exactly they want me to write but the problem is... that i'm not getting the suitable way/method of typing it which can enable be to pass it. so with hope of getting help from you just like how you have been doing since assignment 8,9 i expect you to help me this time as well i hope you would try to understand and help your online course buddy which is me.. please find me the correct answers in order to finish the assignment so that i can move ahead

1
mthotchkiss18 (1)

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

1
janetsomehow1 (1)

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

1
Kevinw980 (0)

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

1
1
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);