diff --git a/docs/archive.html b/docs/archive.html index 0d57c8d42..67e98c523 100644 --- a/docs/archive.html +++ b/docs/archive.html @@ -199,6 +199,9 @@ return `${dt.getDate()}/${dt.getMonth() + 1}/${dt.getFullYear()}`; };
JSONToDate(/Date(1489525200000)/); // "14/3/2017"
+

kmphToMph

Convert kilometers/hour to miles/hour.

Multiply the constant of proportionality with the argument.

const kmphToMph = (kmph) => 0.621371192 * kmph;
+
kmphToMph(10); // 16.09344000614692
+kmphToMph(345.4); // 138.24264965280207
 

levenshteinDistance

Calculates the Levenshtein distance between two strings.

Calculates the number of changes (substitutions, deletions or additions) required to convert string1 to string2. Can also be used to compare two strings as shown in the second example.

const levenshteinDistance = (string1, string2) => {
   if (string1.length === 0) return string2.length;
   if (string2.length === 0) return string1.length;
@@ -226,6 +229,9 @@
 
levenshteinDistance('30-seconds-of-code','30-seconds-of-python-code'); // 7
 const compareStrings = (string1,string2) => (100 - levenshteinDistance(string1,string2) / Math.max(string1.length,string2.length));
 compareStrings('30-seconds-of-code', '30-seconds-of-python-code'); // 99.72 (%)
+

mphToKmph

Convert miles/hour to kilometers/hour.

Multiply the constant of proportionality with the argument.

const mphToKmph = (mph) => 1.6093440006146922 * mph;
+
mphToKmph(10); // 16.09344000614692
+mphToKmph(85.9); // 138.24264965280207
 

pipeLog

Logs a value and returns it.

Use console.log to log the supplied value, combined with the || operator to return it.

const pipeLog = data => console.log(data) || data;
 
pipeLog(1); // logs `1` and returns `1`
 

quickSort

QuickSort an Array (ascending sort by default).

Use recursion. Use Array.prototype.filter and spread operator (...) to create an array that all elements with values less than the pivot come before the pivot, and all elements with values greater than the pivot come after it. If the parameter desc is truthy, return array sorts in descending order.

const quickSort = ([n, ...nums], desc) =>