简体   繁体   English

我是平台的新手,也是新的编程。 我正在学习回调,我有这个练习,我无法理解如何处理它

[英]i'm new in the platform and also new programming. I'm learning callback and i have this excersice that i cannot undesrstand how to aproche it

you must create a function called callback that receives as a parameter a number and a function .您必须创建一个称为回调的 function 作为参数接收一个数字和一个function this function must return the result of that function giving as an argument the parameter number这个 function 必须返回 function 作为参数给出结果

Examples..例子..

// - callback(5, (num)=>{return num*10}) should return 50 // - callback(25, (num)=>{return num/5}) should return 5 // - callback(5, (num)=>{return num*10}) 应该返回 50 // - callback(25, (num)=>{return num/5}) 应该返回 5

Thanks!谢谢!

This question is asking you to create a function, like:这个问题要求您创建一个 function,例如:

const todo = () => {}

that executes a callback using the parameter to the function as the parameter to the callback, an example being:使用 function 的参数作为回调的参数执行回调,例如:

const todo = (a, b) => {
   // call method b using a as parameter
}

If you still can't find the answer, leave me a comment and I will help you out some more.如果您仍然找不到答案,请给我留言,我会为您提供更多帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM