JS Assignment 7: Arguments and Parameters
ReinierB (15)

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 (15)

@JwalyaOza

let school = 'Lambda';
let className = 'Intro to Web Dev'

function nameMySchool(){
  let className = "Web Development Fundamentals"
  console.log(school);
}

nameMySchool();
console.log(className);
// Do not change any code above this line!


// Exercise One: 
// Part One: Create a variable called 'inFunction' and 
//           assign it to the value that will be logged
//           on line 7.
let inFunction =  "Lambda";

// Part Two: Create a variable called 'outsideFunction' and
//           assign it to the value that will be logged on  
//           line 11.
let outsideFunction = "Intro to Web Dev";


// Exercise Two:
// Create a Function called 'multipliesTwoNumbers'. It will take two parameters
// call these parameters 'num1' and 'num2'. Return the two parameters multiplied together.
 function multipliesTwoNumbers(num1,num2) {
   return num1 * num2;
 }

// Exercise Three:
// Create a function called 'sayMyName'. It will take one parameter. Call this
// parameter 'myName'. Return the phrase "Hello, my name is " and the myName parameter.
// eg: if name is 'Dan' it should return the string: 'Hello, my name is Dan'.
function sayMyName(myName) {
  
  return "Hello, my name is " +  myName ;
}
sayMyName(myName);