I’m using JavaScript to pull a value out from a hidden field and display it in a textbox. The value in the hidden field is encoded.
For example,
'; console.log(aString.htmlEncode());
Will output: <script>alert("I hack your site")</script>
<script>alert("I hack your site")</script>
.htmlEncode() will be accessible on all strings once defined.