¿Qué es un Hash?

Dificultad: Medio TypeScript cs trivia
const hash = (str: string): number => {
  let h = 0;
  for (let i = 0; i < str.length; i++) {
    h = (h * 31 + str.charCodeAt(i)) % 1000;
  }
  return h;
};
console.log(hash('HOLA'));
📥 Inputs:
str = 'HOLA'
❓ ¿Cuál es el output?
Ingresa tu respuesta abajo