Problem getting .js file to load via a plugin

Your javascript has an invalid character in it that can’t be rendered by most fonts, unicode 8203, which is why you don’t see it. If I copy your code out of jsfiddle, paste it in a js file, then drop it in a browser, I can see the character on the last line.

As far as your enqueue question is concerned- yes, you should enqueue files rather than inject a script tag directly.

Two potential issues I see with your enqueue though-

You’re not setting jQuery as a dependency. Your script will fail if jQuery isn’t enqueued elsewhere in the theme or a plugin.

Your script should be wrapped in something that runs it when the page has finished loading, like jQuery(document).ready. Without that, your script will run before the elements it acts upon exist in the DOM. Also note that WordPress jQuery is in noConflict mode, so you should reference the jQuery object via jQuery rather than $:

jQuery(document).ready(function($){
    $('p').each(function() {
        var $this = $(this);
        if($this.html().replace(/\s| /g, '').length == 0)
            $this.remove();
    });
});