Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JS参数&;论据_Javascript_Function_Parameters_Console.log - Fatal编程技术网

Javascript JS参数&;论据

Javascript JS参数&;论据,javascript,function,parameters,console.log,Javascript,Function,Parameters,Console.log,请帮我做练习,因为某些原因,我的代码不起作用,也不允许它成功运行 // 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 lo

请帮我做练习,因为某些原因,我的代码不起作用,也不允许它成功运行

// 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);
 }



// 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 = "Juell";
sayMyName(myName);

console.log();

}

我只是这样做了,去掉了最后一个console.log并将let更改为var。因此,下面是您要做的部分:

var myName=“YourName”;
sayMyName(我的名字)

问题是什么?你的函数似乎已经回答了你的3个要求。我认为你不能正确理解练习。@robertlee-很抱歉,我遇到了格式问题,我想问我列出的两个练习问题中的代码有什么问题?由于某些原因,代码无法成功运行。我正在用console.log学习参数和参数,但是这个练习对我来说很有挑战性。你说它不能成功运行是什么意思?你期望它做什么?你到底得到了什么?分享你的完整代码或工作小提琴链接。谢谢