Results for “Collections & styling”
Small, practical examples. Search by task or narrow things down below.
Copy nested structured data independently
TypeScript: structuredClone creates an independent copy of supported structured values.
TypeScript✓ Tested
Deduplicate sorted values
Deduplicate sorted values using a complete Go program with explicit sample inputs.
Go✓ Tested
Distinguish an own property from an inherited one
JavaScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.
JavaScript✓ Tested
Distinguish an own property from an inherited one
TypeScript: Object.hasOwn avoids depending on an object’s possibly shadowed hasOwnProperty method.
TypeScript✓ Tested
Filter values into a new slice
Filter values into a new slice using a complete Go program with explicit sample inputs.
Go✓ Tested
Find an item’s index
Find an item’s index using a complete Go program with explicit sample inputs.
Go✓ Tested
Find members absent from another set
JavaScript: Negate a membership test to calculate the set difference.
JavaScript✓ Tested
Find members absent from another set
TypeScript: Negate a membership test to calculate the set difference.
TypeScript✓ Tested
Find shared members of two sets
JavaScript: Filter one set through the other set’s membership test.
JavaScript✓ Tested
Find shared members of two sets
TypeScript: Filter one set through the other set’s membership test.
TypeScript✓ Tested
Find values missing from another collection
C#: Except removes duplicates as it calculates the set difference.
C#✓ Tested
Group records into map entries
JavaScript: Initialize an array for a missing Map key before appending its values.
JavaScript✓ Tested