Suggest an editImprove this articleRefine the answer for “Callback in another function”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A callback function can be passed simply **as an argument** when calling another function - since in JavaScript functions are **values** (first-class citizens). **Key point:** to pass a callback, specify it as a parameter when calling the function, and inside the receiving function call it by name when it needs to run.Shown above the full answer for quick recall.Answer (EN)ImageA callback function can be passed simply **as an argument** when calling another function - since in JavaScript functions are **values** (first-class citizens). Example: ```javascript function doSomething(callback) { console.log('Doing something...'); callback(); // call the passed callback } function afterDone() { console.log('Done!'); } doSomething(afterDone); ``` Output: ```javascript Doing something... Done! ``` --- You can pass an **anonymous callback** directly at the call site: ```javascript doSomething(() => { console.log('Done!'); }); ``` --- **Summary:** To pass a callback, **specify it as a parameter** when calling the function. And inside the receiving function, **call it by name** when it needs to run.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.