FIND YOUR NEXT FEW LINES

Results for “function”

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

124 snippets foundClear filters
TypeScriptArray restructuring

Create independent rows in a matrix

TypeScript: Use a mapping function to create each row instead of sharing one array with fill.

TypeScript✓ Tested
TypeScriptTypes & functions

Describe an object with an interface

Require named fields on a reusable object shape.

interface✓ Tested
PowerShellCommands & execution context

Discard incidental output from a setup command

PowerShell: Out-Null prevents setup objects from becoming part of a function or script’s useful result.

PowerShell✓ Tested
SQLiteJSON data

Expand a JSON array into rows

Iterate array elements using a table-valued function.

json_each✓ Tested
JavaScriptArray restructuring

Generate a bounded integer range

JavaScript: Array.from supplies each output position to its mapping function.

JavaScript✓ Tested
TypeScriptArray restructuring

Generate a bounded integer range

TypeScript: Array.from supplies each output position to its mapping function.

TypeScript✓ Tested
TypeScriptTypes & functions

Give an optional property a default

Handle missing object fields with nullish coalescing.

optional✓ Tested
PowerShellFunctions & control

Handle a terminating error

Catch conversion failures and produce a clear fallback.

try catch✓ Tested
Bash ScriptsFunctions & arguments

Handle an expected command failure

Branch on a command’s exit code without aborting the script.

exit status✓ Tested
Bash ScriptsFunctions & arguments

Look up values in an associative array

Use named keys for a small in-memory configuration table.

dictionary✓ Tested
SQLText cleanup & matching

Measure the length of ordinary text

SQL: Use the engine’s text-length function; this ASCII example has no trailing spaces.

SQL✓ Tested
SQL ServerText cleanup & matching

Measure the length of ordinary text

SQL Server: Use the engine’s text-length function; this ASCII example has no trailing spaces.

SQL Server✓ Tested