JSFiddle - React, Tailwind, and code Playground
HTML
foo
<script>
test();
</script>
bar
JavaScript
function test() {
$('script:last').replaceWith("hacked");
}
foo
<script>
test();
</script>
bar
function test() {
$('script:last').replaceWith("hacked");
}