Results for “Functions & data types”
Small, practical examples. Search by task or narrow things down below.
Copy a range without changing the source
TypeScript: Array.slice returns a shallow copy of the selected half-open range.
TypeScript✓ Tested
Count days between UTC-midnight dates
TypeScript: A day is exactly 86400000 milliseconds for these explicitly UTC-midnight inputs.
TypeScript✓ Tested
Count the items in a collection
TypeScript: Read the collection’s length instead of hard-coding the loop limit.
TypeScript✓ Tested
Count Unicode code points in a string
TypeScript: String iteration combines surrogate pairs, unlike the UTF-16 length property.
TypeScript✓ Tested
Create a modified copy of an immutable record
C#: A with expression creates a shallow copy with selected changed properties.
C#✓ Tested
Create a network marked for internal connectivity
Docker / Compose: The internal option disables normal external routing for that network.
Docker / Compose✓ Tested
Create a STRICT table
Require values compatible with declared column types.
STRICT✓ Tested
Create and clean up a temporary file
Java: Create a unique file and remove it in finally even when the operation fails.
Java✓ Tested
Create independent rows in a matrix
TypeScript: Use a mapping function to create each row instead of sharing one array with fill.
TypeScript✓ Tested
Declare a named volume in Compose
Mount persistent storage at a service path.
Compose✓ Tested
Declare a preferred canonical URL
HTML: A canonical link identifies the preferred public URL for duplicate representations of a document.
HTML✓ Tested
Declare an indexing preference for a draft page
HTML: A robots meta element can request noindex while allowing link following.
HTML✓ Tested