JSFiddle - React, Tailwind, and code Playground

by Frank Liu

JavaScript

var str = "c234-x3xx-y4yy-zz4z";
console.log( hashCode(str));

function hashCode(s) {
	   
    for(var i = 0, h = 0; i < s.length; i++)
        h = Math.imul(31, h) + s.charCodeAt(i) | 0;
    return h;
}