FIND YOUR NEXT FEW LINES

Results for “script”

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

407 snippets foundClear filters
JavaScriptObject behavior & collections

List an object’s own enumerable keys

JavaScript: Object.keys omits inherited and non-enumerable properties.

JavaScript✓ Tested
TypeScriptObject behavior & collections

List an object’s own enumerable keys

TypeScript: Object.keys omits inherited and non-enumerable properties.

TypeScript✓ Tested
JavaScriptArray restructuring

Map items to multiple output values

JavaScript: flatMap combines mapping and a one-level flattening operation.

JavaScript✓ Tested
TypeScriptArray restructuring

Map items to multiple output values

TypeScript: flatMap combines mapping and a one-level flattening operation.

TypeScript✓ Tested
JavaScriptGetting Started

Measure a short text value

JavaScript: Read the length of an ASCII string. Non-ASCII text may use multiple code units or bytes depending on the language.

JavaScript✓ Tested
TypeScriptGetting Started

Measure a short text value

TypeScript: Read the length of an ASCII string. Non-ASCII text may use multiple code units or bytes depending on the language.

TypeScript✓ Tested
JavaScriptObjects & JSON

Merge object settings

Use object spread to apply JavaScript overrides to defaults.

JavaScript✓ Tested
JavaScriptGetting Started

Name a value that stays fixed

JavaScript: Use a constant declaration or the language’s constant naming convention for a fixed limit.

JavaScript✓ Tested
TypeScriptGetting Started

Name a value that stays fixed

TypeScript: Use a constant declaration or the language’s constant naming convention for a fixed limit.

TypeScript✓ Tested
JavaScriptText handling & Unicode

Normalize identifier case consistently

JavaScript: Use toLowerCase for a simple case-insensitive ASCII identifier lookup.

JavaScript✓ Tested
TypeScriptText handling & Unicode

Normalize identifier case consistently

TypeScript: Use toLowerCase for a simple case-insensitive ASCII identifier lookup.

TypeScript✓ Tested
Bash ScriptsFunction scope & composition

Observe command substitution’s trailing-newline removal

Bash Scripts: Command substitution removes trailing newlines while preserving embedded ones.

Bash Scripts✓ Tested