Using Javascript Callback from plugin in a theme

Ok, I found out here how to procede.

It was so simple I could not believe:

1) include in theme a custom script with a dependency on the favorite plugin.
example:

wp_enqueue_script('script', get_stylesheet_directory_uri() . '/js/myscript.js', 'simple-favorite', '1.0.0', true);

2) in myscript.js just define again the function, and make it do something:

function favorites_after_button_submit(favorites, post_id, site_id, status){
    console.log('done');
}

SO, it looks like a js function can be redefined?