Answers for "take hash from string js"

0

get hash js

location.hash
Posted by: Guest on July-01-2020
-1

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!'));
Posted by: Guest on July-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language