JSFiddle - React, Tailwind, and code Playground
by hakan
HTML
<p style="color:#72bd4">
[email protected] Save Hansson
</p>
JavaScript
function hashCode(str) { // java String#hashCode
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
return hash;
}
function intToARGB(i){
return ((i>>24)&0xFF).toString(16) +
((i>>16)&0xFF).toString(16) +
((i>>8)&0xFF).toString(16) +
(i&0xFF).toString(16);
}
alert(intToARGB(hashCode("Carrots, raw")))