简体   繁体   中英

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 . this function must return the result of that function giving as an argument the parameter number

Examples..

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

Thanks!

This question is asking you to create a function, like:

const todo = () => {}

that executes a callback using the parameter to the function as the parameter to the callback, an example being:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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