Preview:
function fetchData(callback) {
  setTimeout(function () {
    const data = { id: 1, name: 'Example Data' };
    callback(data);
  }, 2000); // Simulating of 2 second delay
}

// callback
function processData(result) {
  console.log('Succesfull:', result);
}

// call function fetchData with transfer function processData like a callback
fetchData(processData);

console.log('Inquiry was sended.');
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter