Is it possible to override only a part of another plugin’s / theme’s js (asset) file?

I try to go one step forward based on this question and instead of overriding the whole .js file of another plugin, i’m wondering is it possible to override/swap only a part of that js file dynamically?

To somehow maybe ‘inject’/ import my own function(s) additionally into that specific file safely (and fairly natively:)?