Using the “Catch errors” library, that would be:
Still, I wonder why a ready-to-use predicate is not in the “Getters and setters” library?
BTW I wrote a different kind of JavaScript detector some time ago, checking whether any JavaScript code was used within a custom block's implementation definition, or within any other custom block called (directly or indirectly) by the initial block.