30秒学会 JavaScript 片段 – randomIntArrayInRange
Returns an array of n random integers in the specified range. Use Array.from() to create an empty ar...
Returns an array of n random integers in the specified range. Use Array.from() to create an empty ar...
Returns the last element in a list. use lst[-1] to return the last element of the passed list.
Creates an array of key-value pair arrays from an object. Use Object.keys() and Array.prototype.map(...
Converts a string to a URL-friendly slug. Uses preg_replace() to replace invalid chars with dashes, ...
Deep flattens an array. Use recursion. Use array_push, splat operator and an empty array to flatten ...
Checks if the provided value is of the specified type. Ensure the value is not undefined or null usi...
Returns the value of the last element in the provided collection that satisfies the provided testing...
Generates all permutations of a string (contains duplicates). ⚠️ WARNING: This function’s exec...
Returns the maximum of the given dates. Use the ES6 spread syntax with Math.max to find the maximum ...
Capitalizes the first letter of a string. Use String.toUpperCase() to capitalize first letter and St...