Results for “item”
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 index of an array item
PowerShell: Array.IndexOf returns -1 when the requested item is absent.
PowerShell✓ 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
Give an item the remaining horizontal space
CSS: A growing flex item absorbs free space after fixed items have been sized.
CSS✓ Tested
Insert a list item at the beginning
jQuery: Learn how to insert a list item at the beginning in a complete browser example.
jQuery✓ Tested
Insert an item at the beginning
jQuery: prepend inserts before the existing children.
jQuery✓ Tested
Join array items with a one-character separator
Bash Scripts: A local IFS controls the separator used by the quoted star expansion.
Bash Scripts✓ Tested
Keep only the most recent items
Python: Use a bounded deque to discard the oldest item as new values arrive.
Python✓ Tested
Map items to multiple output values
JavaScript: flatMap combines mapping and a one-level flattening operation.
JavaScript✓ Tested
Map items to multiple output values
TypeScript: flatMap combines mapping and a one-level flattening operation.
TypeScript✓ Tested