JSFiddle - React, Tailwind, and code Playground

by edddotcom

HTML

<a id="btn" href="">Click</a>

<textarea id="message"></textarea>
<p></p>

JavaScript

String.prototype.hashCode = function () {
    var hash = 0;
    if (this.length == 0) return hash;
    for (i = 0; i < this.length; i++) {
        char = this.charCodeAt(i);
        hash = ((hash << 5) - hash) + char;
        hash = hash & hash; // Convert to 32bit integer
    }
    return hash;
}
jQuery("a#btn").click(function () {
    var thought = jQuery("#message").val();
    alert(thought.hashCode().toString());
    $("p").html(thought.hashCode().toString());
});