Lets say, I have a function:
function my_function(some_variable, count, callback) {
// some code here, doing jQuery animation, transition, etc., f.e:
var temp = $('#some_element').clone().appendTo('body');
temp.animate({'top': newOffset.top, 'left': newOffset.left }, 'slow', function() {
if (callback !== undefined) {
callback();
return count;
}
else {
return count;
}
});
}
So when I call it f.e like this:
my_function('test', 75, function(result) {
console.log(result);
});
I need to have in the console 75
. But it is returning undefined
.
So my question is, how I can return in callback the same value, as I passed in the count
?