#Javascript

The JavaScript snippet collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.

gcd

Published by Eko Spt 1 min read
Calculates the greatest common divisor between two or more numbers/arrays.

Insertion Sort

Published by Eko Spt 1 min read
Sorts an array of numbers, using the insertion sort algorithm.

addDaysToDate

Published by Eko Spt 1 min read
Calculates the date of `n` days from the given date, returning its string representation.

addClass

Published by Eko Spt 1 min read
Adds a class to an HTML element.

addMinutesToDate

Published by Eko Spt 1 min read
Calculates the date of `n` minutes from the given date, returning its string representation.

bucketSort

Published by Eko Spt 1 min read
Sorts an array of numbers, using the bucket sort algorithm.

Caesar Cipher

Published by Eko Spt 1 min read
Encrypts or decrypts a given string using the Caesar cipher.

kNearestNeighbors

Published by Eko Spt 1 min read
Classifies a data point relative to a labelled data set, using the k-nearest neighbors algorithm.

kMeans

Published by Eko Spt 1 min read
Groups the given data into `k` clusters, using the k-means clustering algorithm.