Results for “node”
Small, practical examples. Search by task or narrow things down below.
Find the first matching array item
JavaScript: find returns undefined when no item satisfies the predicate.
JavaScript✓ Tested
Find the first matching array item
TypeScript: find returns undefined when no item satisfies the predicate.
TypeScript✓ Tested
Find the position of a matching item
JavaScript: findIndex returns -1 when the predicate matches nothing.
JavaScript✓ Tested
Find the position of a matching item
TypeScript: findIndex returns -1 when the predicate matches nothing.
TypeScript✓ Tested
Find what remains after division
JavaScript: Use the remainder operator to count items left after forming complete groups.
JavaScript✓ Tested
Find what remains after division
TypeScript: Use the remainder operator to count items left after forming complete groups.
TypeScript✓ Tested
Flatten a single nesting level
JavaScript: flat defaults to a depth of one and creates a new array.
JavaScript✓ Tested
Flatten a single nesting level
TypeScript: flat defaults to a depth of one and creates a new array.
TypeScript✓ 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
Format whole seconds as hours minutes and seconds
TypeScript: Use integer divisions and remainders for a nonnegative duration.
TypeScript✓ Tested
Generate a bounded integer range
JavaScript: Array.from supplies each output position to its mapping function.
JavaScript✓ Tested