Results for “collection”
Small, practical examples. Search by task or narrow things down below.
Build an object from key-value entries
JavaScript: Object.fromEntries converts an iterable of pairs into ordinary own properties.
JavaScript✓ Tested
Build an object from key-value entries
TypeScript: Object.fromEntries converts an iterable of pairs into ordinary own properties.
TypeScript✓ Tested
Check whether any selected element matches
jQuery: is returns a Boolean without changing the selection.
jQuery✓ Tested
Combine two selections
jQuery: add returns a combined collection in document order.
jQuery✓ Tested
Copy a slice without sharing storage
Copy a slice without sharing storage using a complete Go program with explicit sample inputs.
Go✓ Tested
Copy nested structured data independently
JavaScript: structuredClone creates an independent copy of supported structured values.
JavaScript✓ Tested
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 parents containing a matching descendant
jQuery: has retains parents with a matching descendant.
jQuery✓ Tested
Filter values into a new slice
Filter values into a new slice using a complete Go program with explicit sample inputs.
Go✓ Tested