HashMap.js redundancy in hash function

Studying HashMaps as part of the Technical Interview course offers this solution for calculating a hash.
For the line hashCode += hashCode + key.charCodeAt(i);
Why wouldn’t you use hashCode += key.charCodeAt(i);
This answer is rejected.

  hash(key) {
    let hashCode = 0;
    for (let i = 0; i < key.length; i++) {
      hashCode += hashCode + key.charCodeAt(i);
    return hashCode;
module.exports = HashMap;```

Seems odd at first glance, do you have the link for this?

No. I’m new to CodeAcademy. Is in possible to link to code in the course work?
For what it’s worth, the line is present throughout the HashMap study.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.