callback call own function when finished javascript code example
Example: create callback function javascript
function add(a, b, callback) {
if (callback && typeof(callback) === "function") {
callback(a + b);
}
}
add(5, 3, function(answer) {
console.log(answer);
});