Ask coding questions

← Back to all posts
JS Assignment 7
MarindaHeim (0)

I am super new to this and I'm having a lot of trouble on the pre-course. I have been able to find answers to the other questions, but this one I have searched and searched for what I'm doing wrong. I have pasted the questions with the answers I have come up with. Any help would be appreciated, TIA.

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

// 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.
function parameterExercise (param1, param2){
console.log (param2);
}

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

// 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 = "Marinda";
sayMyName("myname");

Answered by vedprad1 (815) [earned 5 cycles]
View Answer
Commentshotnewtop
vedprad1 (815)

You have several mistakes.
1. In the parameter exercise, there should be no space between the name of the function and the parentheses.
2. In the parameter exercise, there should be no space between console.log and the parentheses.
3. The variable name myName is supposed to be camel case. You wrote it as all lowercase.
4. In the very last line, you put myName in quotation marks. However, it is a variable, so you need to remove the quotation marks.

The final product should look like this:

function parametersExercise(param1, param2) {
  console.log(param2);
}

function exerciseTwo() {
  function sayMyName(parameter1) {
    console.log(parameter1);
  }
}

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

If this answers your question, please check the checkmark on the left side of this message. Thanks and Good Luck!

MarindaHeim (0)

@vedprad1
I did everything you said (at least I think I did) and neither are passed. What am I doing wrong?

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

// 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.
function parameterExercise(param1, param2){
console.log(param2);
}

// DO NOT CHANGE ANYTHING ON THE NEXT FOUR LINES!

function exerciseTwo(){
function sayMyName(parameter1){
console.log(parameter1);
}
}

// Continue below this line:

// 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 = 'Marinda';
sayMyName(myName);

malvoliothegood (268)

@MarindaHeim
The answer @vedprad1 gave looks OK to me. Is the spelling of the first function name correct?
Should function parameterExercise be function parametersExercise

vedprad1 (815)

@malvoliothegood, @MarindaHeim : You are right. It is supposed to be parametersExercise, not parameterExercise.