diff --git a/docs/beginner.html b/docs/beginner.html index 5aa9a67aa..60d04d2b9 100644 --- a/docs/beginner.html +++ b/docs/beginner.html @@ -23,7 +23,7 @@
- +Curated collection of useful JavaScript snippets
that you can understand in 30 seconds or less.
false if any of them divides the given number, else return <
};
isPrime(11); // true+
Returns the last element in an array.
+Use arr.length - 1 to compute the index of the last element of the given array and returning it.
const last = arr => arr[arr.length - 1]; +
last([1, 2, 3]); // 3 +
Returns the least common multiple of two or more numbers.
Use the greatest common divisor (GCD) formula and the fact that lcm(x,y) = x * y / gcd(x,y) to determine the least common multiple.
diff --git a/scripts/web.js b/scripts/web.js
index 83c8f824a..b1daa7c50 100644
--- a/scripts/web.js
+++ b/scripts/web.js
@@ -51,7 +51,7 @@ const snippetsPath = './snippets',
docsPath = './docs';
// Set variables for script
let snippets = {},
- beginnerSnippetNames = ['everyNth', 'filterNonUnique', 'last.md', 'maxN', 'minN', 'nthElement', 'sample', 'similarity', 'tail', 'currentURL', 'hasClass', 'getMeridiemSuffixOfInteger', 'factorial', 'fibonacci', 'gcd', 'isDivisible', 'isEven', 'isPrime', 'lcm', 'randomIntegerInRange', 'sum', 'reverseString', 'truncateString'],
+ beginnerSnippetNames = ['everyNth', 'filterNonUnique', 'last', 'maxN', 'minN', 'nthElement', 'sample', 'similarity', 'tail', 'currentURL', 'hasClass', 'getMeridiemSuffixOfInteger', 'factorial', 'fibonacci', 'gcd', 'isDivisible', 'isEven', 'isPrime', 'lcm', 'randomIntegerInRange', 'sum', 'reverseString', 'truncateString'],
startPart = '',
endPart = '',
output = '',