2
JS Assignment 7: Arguments and Parameters
ReinierB (7)

JS Assignment 7: Arguments, I do not know what is going on, The console is printing what they asking for to be undefined, but I still get an error? im passing the second exercise, but not the first. It is a bug or am I doing something wrong that i cant see? i check stackflow some people were having the same problems without solutions.
// Exercise One:
// Step One: Create a function called 'parametersExercise'.
// Step Two: This function will need to take two parameters, call them 'param1' and 'param2'
// Step Three: The function should console log the second parameter.

// DO NOT CHANGE ANYTHING ON THE NEXT FOUR LINES!
function exerciseTwo(){
function sayMyName(parameter1){
console.log(parameter1);
}

// Continue below this line:
function parametersExercise(param1, param2) {
console.log(param2);
}

parametersExercise();

// Exercise Two:
// Step One create a variable called 'myName' and assign it the a string of your name.
// Step Two: Call the function called "sayMyName",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 = "Reinier";
sayMyName(myName);
}
exerciseTwo();

You are viewing a single comment. View All
3
TheDrone7 (516)

So I went through what you posted. Firstly, the part where it says DO NOT CHANGE THE NEXT FOUR LINES, you never closed the function named exerciseTwo(), so first add a closing bracket after that }. Nextly while calling the exerciseOne function, you need to pass 2 parameters for it to print something otherwise the values for param1 and param2 will default to undefined. Hope this helps. Let me know if it still doesn't work. Nextly, here are some tips while asking questions, use three backticks ``` to enclose code blocks. Finally, it would be easier if you shared the link to repl itself which would allow us to have a look at the error ourselves.