Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript hash string

function hashCode(str) {
  return str.split('').reduce((prevHash, currVal) =>
    (((prevHash << 5) - prevHash) + currVal.charCodeAt(0))|0, 0);
}

// Test
console.log("hashCode("Hello!"): ", hashCode('Hello!'));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #hash #string
ADD COMMENT
Topic
Name
1+6 =