Suggest an editImprove this articleRefine the answer for “Parameters in a callback”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)Parameters are passed into a **callback** the same way as into any function: you just call the callback with the needed arguments inside another function. **Key point:** the calling function itself passes the callback the data it needs at call time.Shown above the full answer for quick recall.Answer (EN)Image### 1. By calling the callback with arguments inside a function You pass the callback itself, and the calling function passes it the data it needs. ```javascript function fetchData(callback) { const data = 'Data from the server'; callback(data); // pass a parameter into the callback } function showData(info) { console.log('Received:', info); } fetchData(showData); ``` Output: ```javascript Received: Data from the server ``` --- ### 2. Through a closure (when you need to "bake in" arguments in advance) ```javascript function processUser(action) { const user = { name: 'Tim' }; action(user); } processUser(user => console.log(`Hello, ${user.name}!`)); ``` or: ```javascript function doLater(callback) { setTimeout(callback, 1000); } doLater(() => console.log('In a second!')); ``` --- **Summary:** Parameters are passed into a callback the same way as into any function - you just need to **call the callback with the needed arguments** inside another function.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.