Ask coding questions

← Back to all posts
JS assignment 7
jagerxx450 (1)

Having trouble on assignment 7.Specifically exercise two, lesson two.
Tried multiple times but, couldn't figure out the solution.If the link doesn't work I might have the repl.it closed. I will leave the link in a comment.

Commentshotnewtop
heyitsmarcus (287)

@jagerxx450, when you're copying and pasting code, please be sure to copy the entirety of the code.

ash15khng (397)

We can't see student submissions, so please paste the code into a repl with the question.

jagerxx450 (1)

@ash15khng
// Exercise Two:
// Step One create a variable called 'myName' and assign it the a string of your name.
// Step Two: Modify the function to push the given item onto the end of the array and return the array.,passing the 'myName' variable as it's only argument.
// NOTE: You do NOT need to create the function (sayMyName), doing so will break the test.
// It has been created for you.

let myName = 'john' ;
sayMyName(myName);

ExerciseTwo();

ash15khng (397)

@jagerxx450 Is there an array specified anywhere?

jagerxx450 (1)

@ash15khng I don't think so do I need to create one to make it work?

ash15khng (397)

@jagerxx450 reading the question, I think there should be an array somewhere. Anyways, to push an item onto the end of an array, do Array.push(myName).

jagerxx450 (1)

@ash15khng keep getting an error after I use the Array.push(myName).
The error says Array.push is not a function

ash15khng (397)

@jagerxx450 Uh, replace Array with the name of the array?

jagerxx450 (1)

@ash15khng alright I did that but, now its saying that sayMyName is not defined.I'm not supposed to add sayMyName in the array..right?

ebest (574)

@jagerxx450 Of course! Just take the code you have now and put it on whatever site you are using.