Implement the SDBM hash function in JavaScript
SDBM is a simple, non-cryptographic hash function that can hash strings into whole numbers. Here's a JavaScript implementation.
30 seconds of code contains a curated collection of code articles covering a wide range of development needs. The collection spans many topics, ranging from simple coding problems to theoretical concepts and development techniques.
SDBM is a simple, non-cryptographic hash function that can hash strings into whole numbers. Here's a JavaScript implementation.
Use some clever JavaScript tricks to listen for and handle scroll stop events in the browser.
Learn how to leverage the native fonts of the operating system to get close to a native app feel.
Wrap a string to a given number of characters using a string break character in JavaScript.
Learn how to create a promise that resolves after a given amount of time in JavaScript.
Learn how to replicate the behavior of Array.prototype.map() for strings.
Calculate the number of days in a month for a given year using JavaScript.
Calculate the coordinates of the current scroll position in the browser window using JavaScript.
Easily and reliably calculate the width of the browser's vertical scrollbar with JavaScript.
Find the prime factors of a number using trial division in JavaScript.
Implement the Luhn Algorithm, used to validate a variety of identification numbers.
Learn how to retrieve and manipulate the styles of an HTML element easily and efficiently with JavaScript.
Learn everything you need to know about JavaScript's call(), apply() and bind() in this short guide.
Learn how to perform various transformations on the keys of a JavaScript object.
Learn how to convert text into HTML-safe strings and vice versa using JavaScript.
Use the Date object and some clever tricks to get the first or last date of a month in JavaScript.
Use Math.pow() to calculate the nth root of a given number in JavaScript.
Calculate the ranking of an array based on a comparator function in JavaScript.
Create arrays of numbers in arithmetic and geometric progression.
Use the Array.prototype.every() method to check if all values of an array are equal in JavaScript.
Efficiently check if a numeric array is sorted in ascending or descending order in JavaScript.
Learn common number formatting operations, such as rounding, padding, optional decimal marks, currency, seconds, bytes, and more.
Clamping and mapping a number to a range are two common and easily confused operations. Learn how to perform each in JavaScript.
Learn how to perform HTTP GET, POST, PUT, and DELETE requests in JavaScript.