FIND YOUR NEXT FEW LINES

Results for “Functions & data types”

Small, practical examples. Search by task or narrow things down below.

787 snippets foundClear filters
TypeScriptGetting Started

Combine text with a name

TypeScript: Construct a greeting from a fixed prefix and a stored name.

TypeScript✓ Tested
AngularLifecycle & observable data

Combine the latest values from observables

Combine the latest values from observables with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
TypeScriptGetting Started

Compare a value with a limit

TypeScript: Turn a comparison into a readable yes or no result.

TypeScript✓ Tested
TypeScriptNumbers & numeric validation

Compare bounded floating-point results with a tolerance

TypeScript: Use an absolute error threshold for values known to be near one.

TypeScript✓ Tested
TypeScriptText handling & Unicode

Compare canonically equivalent Unicode text

TypeScript: Normalize to NFC before comparing equivalent composed and decomposed text.

TypeScript✓ Tested
TypeScriptArray restructuring

Concatenate arrays without mutating either input

TypeScript: concat creates a shallow combined sequence.

TypeScript✓ Tested
TypeScriptUTC date operations

Construct a date from Unix seconds

TypeScript: Multiply seconds by 1000 before creating a Date.

TypeScript✓ Tested
TypeScriptPromises & iteration protocols

Consume an asynchronous sequence

TypeScript: for await waits for each value of an async iterator in sequence.

TypeScript✓ Tested
TypeScriptNumbers & numeric validation

Convert between integer bases

TypeScript: Supply a radix when parsing a nondecimal integer string.

TypeScript✓ Tested
TypeScriptUTC date operations

Convert epoch milliseconds to whole seconds

TypeScript: JavaScript Date stores milliseconds while many APIs use Unix seconds.

TypeScript✓ Tested
TypeScriptGetting Started

Convert known numeric text to an integer

TypeScript: Convert a trusted literal to an integer before adding. Validate external input before converting it.

TypeScript✓ Tested
JavaFile operations & binary data

Copy a file without replacing an existing destination

Java: Files.copy fails if the destination already exists unless replacement is explicitly enabled.

Java✓ Tested