JS Assignment 7: Arguments and Parameters
ReinierB (11)

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
ReinierB (11)

@JwalyaOza `// Exercise One: Create a vaiable called 'numbersArray',
// assign it to an array containing 5 numbers (any numbers).
let numbersArray = [2,34,4,5,6];

// Exercise Two: Create a variable called 'cars',
// assign it to an array containing the names of three cars.
let cars = ['honda', 'Hunday', 'Chevy'];

function exerciseThree(bandsArray){
// Exercise Three: In this function you will be given an array called 'bandsArray'.
// console log the third band in the array.
// Note: DO NOT create a new array in this challenge.
// Note: Remember that array indecies start at 0.
console.log(bandsArray[2]);
}

function exerciseFour(citiesArray){
// Exercise Four: In this function you will be given an array called 'citiesArray.
// re-assign the fourth city in the array to 'Santa Fe'.
// Note: DO NOT create a new array in this challenge.
// Note: Remember that array indecies start at 0.
citiesArray[citiesArray.length -2];
citiesArray[3] = 'Santa Fe';

// Complete your work on the line above.
return citiesArray;
}

here is my solution! remember to try to understand why