Please Tell me what's happening in the callback function concept in vue.js

This is a concept called callbacks in Vue.js. This concept says that
" The point is that functions in JavaScript are like any other data type. They can be created at any time, set to a variable, and reassigned. It shouldn’t be a surprise then that they can be passed into another function and returned from another function. "

function fnGenerator() {
return function() {
console.log(‘Ran the inner function’);
}
}

const fnReturned = fnGenerator();
console.log(fnReturned); // → [Function]
fnReturned(); // → Ran the inner function

It’s a code snippet from vue.js, can some explain how it works,
I don’t understand how it works when they call the function renamed with a const fnReturned();

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.