diff --git a/README.md b/README.md index c8d779f04..90f5ba61f 100644 --- a/README.md +++ b/README.md @@ -3683,7 +3683,7 @@ round(1.005, 2); // 1.01
[⬆ Back to top](#table-of-contents) -### sbdm +### sdbm Hashes the input string into a whole number. diff --git a/docs/index.html b/docs/index.html index 6aa025fbc..5a4358afd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -796,7 +796,7 @@ own individual rating by supplying it as the third argument.
randomNumberInRange(2, 10); // 6.0211363285087005
 

round

Rounds a number to a specified amount of digits.

Use Math.round() and template literals to round the number to the specified number of digits. Omit the second argument, decimals to round to an integer.

const round = (n, decimals = 0) => Number(`${Math.round(`${n}e${decimals}`)}e-${decimals}`);
 
round(1.005, 2); // 1.01
-

sbdm

Hashes the input string into a whole number.

Use String.split('') and Array.reduce() to create a hash of the input string, utilizing bit shifting.

const sdbm = str => {
+

sdbm

Hashes the input string into a whole number.

Use String.split('') and Array.reduce() to create a hash of the input string, utilizing bit shifting.

const sdbm = str => {
   let arr = str.split('');
   return arr.reduce(
     (hashCode, currentVal) =>