FIND YOUR NEXT FEW LINES

Results for “script”

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

407 snippets foundClear filters
Bash ScriptsArray operations

Remove an indexed element and compact the array

Bash Scripts: Unsetting an element leaves a gap; reassigning the values creates consecutive indices.

Bash Scripts✓ Tested
JavaScriptArrays

Remove duplicate values

Use a JavaScript Set to preserve the first occurrence of each primitive value.

JavaScript✓ Tested
JavaScriptRegular expressions & URL encoding

Reorder captured text in a replacement

JavaScript: Use numbered replacement groups to rearrange a known two-part name.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Reorder captured text in a replacement

TypeScript: Use numbered replacement groups to rearrange a known two-part name.

TypeScript✓ Tested
Bash ScriptsGetting Started

Repeat a command for several words

Bash Scripts: Repeat a command for several words with a small standalone Bash program.

Bash Scripts✓ Tested
JavaScriptGetting Started

Repeat a fixed number of times

JavaScript: Use a counted loop to print three numbered steps.

JavaScript✓ Tested
TypeScriptGetting Started

Repeat a fixed number of times

TypeScript: Use a counted loop to print three numbered steps.

TypeScript✓ Tested
JavaScriptText handling & Unicode

Repeat a string a fixed number of times

JavaScript: String.repeat requires a nonnegative finite repetition count.

JavaScript✓ Tested
TypeScriptText handling & Unicode

Repeat a string a fixed number of times

TypeScript: String.repeat requires a nonnegative finite repetition count.

TypeScript✓ Tested
Bash ScriptsArguments & decisions

Repeat until a condition becomes true

Bash Scripts: An until loop continues while its test returns a nonzero status.

Bash Scripts✓ Tested
JavaScriptGetting Started

Repeat while a condition holds

JavaScript: Count down while a positive number remains, updating the loop variable on each iteration.

JavaScript✓ Tested
TypeScriptGetting Started

Repeat while a condition holds

TypeScript: Count down while a positive number remains, updating the loop variable on each iteration.

TypeScript✓ Tested