Results for “JavaScript”
Small, practical examples. Search by task or narrow things down below.
Find members absent from another set
JavaScript: Negate a membership test to calculate the set difference.
JavaScript✓ Tested
Find shared members of two sets
JavaScript: Filter one set through the other set’s membership test.
JavaScript✓ Tested
Find the final day of a month
JavaScript: Day zero of the following UTC month selects the previous month’s final day.
JavaScript✓ Tested
Find the first matching array item
JavaScript: find returns undefined when no item satisfies the predicate.
JavaScript✓ Tested
Find the position of a matching item
JavaScript: findIndex returns -1 when the predicate matches nothing.
JavaScript✓ Tested
Find what remains after division
JavaScript: Use the remainder operator to count items left after forming complete groups.
JavaScript✓ Tested
Flatten a single nesting level
JavaScript: flat defaults to a depth of one and creates a new array.
JavaScript✓ Tested
Format an ISO date
Format a UTC JavaScript Date deterministically.
JavaScript✓ Tested
Format whole seconds as hours minutes and seconds
JavaScript: Use integer divisions and remainders for a nonnegative duration.
JavaScript✓ Tested
Generate a bounded integer range
JavaScript: Array.from supplies each output position to its mapping function.
JavaScript✓ Tested
Group records into map entries
JavaScript: Initialize an array for a missing Map key before appending its values.
JavaScript✓ Tested
Handle three possible outcomes
JavaScript: Check high, normal and low values with an ordered conditional chain.
JavaScript✓ Tested